test(auth): assert unwrapped factory rejected at branded slot

This commit is contained in:
2026-05-12 21:49:57 +02:00
parent db646c22e4
commit 17bf9fd0c1

View File

@@ -0,0 +1,28 @@
import { describe, it } from "vitest";
import type { ProductionUseCase } from "@repo/core-shared/conformance";
import type { AuthManifest } from "../feature.manifest";
import type {
SignInInput,
SignInOutput,
} from "../application/use-cases/sign-in.use-case";
import { signInUseCase } from "../application/use-cases/sign-in.use-case";
describe("auth.signIn binding slot (type-level)", () => {
it("rejects an unwrapped factory", () => {
type Slot = ProductionUseCase<
SignInInput,
SignInOutput,
AuthManifest["useCases"]["signIn"]
>;
// Build the unwrapped factory exactly as it would be at the use-case file.
// It returns a function with no brand attached — must not be assignable.
const fakeRepo = {} as never;
const fakeAuth = {} as never;
const unwrapped = signInUseCase(fakeRepo, fakeAuth);
// @ts-expect-error — unwrapped factory has no __instrumented / __captured brand
const _bad: Slot = unwrapped;
void _bad;
});
});