Files
tech-log-frontend/tests/helpers/studio-install-context.ts
T

32 lines
1.3 KiB
TypeScript

import { createCsrfTokenProvider } from "../../src/features/tech-log/adapters/http/studio-session-csrf.ts";
import type { TechLogInstallContext } from "../../src/features/tech-log/adapters/create-tech-log-feature-input.ts";
/**
* The install context the existing Studio test suite composes against. It
* always selects the mock adapter, so `contractOperations` is a throwing stub
* — `createTechLogFeatureInstalledInput` never reads it on the MOCK branch.
*
* `createStudioAssetGateway` also selects a mock adapter on `studioSource:
* "MOCK"` (Task 10 fix round 1, I2) that shares its Asset store with
* `createStudioGateway`'s mock, so `contractOperations`/`csrf` still never
* see real use here. `apiBaseUrl`/`requestTimeoutMs` stay well-formed anyway
* — they are read on the HTTP branch only, but this context is a plain
* value, not a conditional one.
*/
export const MOCK_STUDIO_INSTALL_CONTEXT: TechLogInstallContext = Object.freeze({
studioSource: "MOCK",
publicSource: "MOCK",
http: Object.freeze({
async execute() {
throw new Error("contract executor is not used by the mock Studio gateway");
},
}),
apiBaseUrl: "http://mock-studio.test/",
requestTimeoutMs: 10_000,
csrf: createCsrfTokenProvider({
async execute() {
throw new Error("CSRF provider is not used by the mock Studio gateway");
},
}),
});