feat: select the TechLog Studio adapter from runtime configuration
Adds TECH_LOG_STUDIO_SOURCE (MOCK | HTTP, default MOCK) to the V2 runtime
config schema so a build can switch createTechLogFeatureInstalledInput
between the mock and HTTP Studio gateways without a rebuild. V1 documents
predate the key and always normalize to MOCK. The HTTP gateway is
constructed with only { operations } per Task 4's actual signature -
no CSRF provider is wired here; that lands with attachCredentials at a
later composition-root task.
Updates every existing Studio test call site to the new required
createTechLogFeatureInstalledInput(context) signature via a shared
tests/helpers/studio-install-context.ts MOCK fixture, so the whole
existing Studio suite keeps exercising the mock adapter unchanged.
This commit is contained in:
@@ -32,8 +32,11 @@ function inputOf(document: WorkingCopy) {
|
||||
return input;
|
||||
}
|
||||
|
||||
function installedInputs(): InstalledInputs {
|
||||
function installedInputs(
|
||||
studioSource: "MOCK" | "HTTP" = "MOCK",
|
||||
): InstalledInputs {
|
||||
return createInstalledFeatureInputs({
|
||||
studioSource,
|
||||
contractOperations: {
|
||||
async execute() {
|
||||
throw new Error("reference executor is not used by composition tests");
|
||||
@@ -59,6 +62,16 @@ test("installs TechLog beside the retained reference feature through application
|
||||
);
|
||||
});
|
||||
|
||||
test("selects the mock gateway by default and the HTTP gateway when switched", async () => {
|
||||
const mockGateway = installedInputs("MOCK")["tech-log"].createStudioGateway();
|
||||
const httpGateway = installedInputs("HTTP")["tech-log"].createStudioGateway();
|
||||
|
||||
// The mock reads an in-memory fixture immediately. HTTP defers to the
|
||||
// (here, throwing) contract executor, so it rejects instead.
|
||||
await assert.doesNotReject(mockGateway.getDashboard());
|
||||
await assert.rejects(httpGateway.getDashboard());
|
||||
});
|
||||
|
||||
test("each createStudioGateway call owns an isolated mutable Studio session", async () => {
|
||||
const installed = installedInputs();
|
||||
const first = installed["tech-log"].createStudioGateway();
|
||||
|
||||
Reference in New Issue
Block a user