21 lines
889 B
TypeScript
21 lines
889 B
TypeScript
import { describe, expectTypeOf, it } from "@suaveplan/testing/runner";
|
|
import type { MutexRelease, PluginMutex } from "./mutex-contract.js";
|
|
|
|
describe("mutex-contract spec-conformance", () => {
|
|
it("PluginMutex declares acquire tryAcquire", { timeout: 5000 }, () => {
|
|
expectTypeOf<PluginMutex>().toHaveProperty("acquire");
|
|
expectTypeOf<PluginMutex>().toHaveProperty("tryAcquire");
|
|
expectTypeOf<PluginMutex["acquire"]>().toEqualTypeOf<
|
|
(plugin: string) => Promise<MutexRelease>
|
|
>();
|
|
expectTypeOf<PluginMutex["tryAcquire"]>().toEqualTypeOf<
|
|
(plugin: string) => MutexRelease | null
|
|
>();
|
|
});
|
|
|
|
it("MutexRelease declares release", { timeout: 5000 }, () => {
|
|
expectTypeOf<MutexRelease>().toHaveProperty("release");
|
|
expectTypeOf<MutexRelease["release"]>().toEqualTypeOf<() => void>();
|
|
});
|
|
});
|