import { describe, expectTypeOf, it } from "@suaveplan/testing/runner"; import type { InferConfig, ServiceFixture } from "./service-fixture.js"; describe("ServiceFixture interface", () => { it("enforces the ServiceFixture shape", { timeout: 5000 }, () => { type ExampleConfig = { host: string; port: number }; const fixture: ServiceFixture = { name: "example", start: async () => ({ host: "localhost", port: 1234 }), stop: async () => {}, healthCheck: async () => true, }; expectTypeOf(fixture.name).toEqualTypeOf(); expectTypeOf(fixture.start).toEqualTypeOf< () => Promise >(); expectTypeOf(fixture.stop).toEqualTypeOf<() => Promise>(); expectTypeOf(fixture.healthCheck).toEqualTypeOf< () => Promise >(); }); it("InferConfig extracts TConfig from a ServiceFixture implementation", { timeout: 5000, }, () => { type ExampleConfig = { endpoint: string; apiKey: string }; interface MyFixture extends ServiceFixture {} type Extracted = InferConfig; expectTypeOf().toEqualTypeOf(); }); it("InferConfig returns never for non-ServiceFixture types", { timeout: 5000, }, () => { type Extracted = InferConfig; expectTypeOf().toEqualTypeOf(); }); });