test(auth): assert unwrapped factory rejected at branded slot
This commit is contained in:
28
packages/auth/src/di/bind-production.types.test.ts
Normal file
28
packages/auth/src/di/bind-production.types.test.ts
Normal 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;
|
||||||
|
});
|
||||||
|
});
|
||||||
Reference in New Issue
Block a user