Files
suaveplan/packages/api-stack/api/api-lifecycle/src/mutex-contract/mutex-contract.spec-conformance.test.ts
2026-05-27 23:29:53 +01:00

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>();
});
});