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:
DongHyeonka
2026-08-18 01:57:15 +09:00
parent 7424ed4594
commit 3b641906b8
31 changed files with 169 additions and 47 deletions
@@ -15,6 +15,7 @@ import {
} from "vitest";
import { createTechLogFeatureInstalledInput } from "../../../src/features/tech-log/adapters/create-tech-log-feature-input.ts";
import { MOCK_STUDIO_INSTALL_CONTEXT } from "../../helpers/studio-install-context.ts";
import { FIXTURE_IDS } from "../../../src/features/tech-log/adapters/mock/fixtures.ts";
import { StudioGatewayError } from "../../../src/features/tech-log/application/ports/studio-gateway-error.ts";
import type { StudioGateway } from "../../../src/features/tech-log/application/ports/studio-gateway.ts";
@@ -79,7 +80,7 @@ afterEach(() => {
function renderInStudio(
node: React.ReactNode,
gateway: StudioGateway = createTechLogFeatureInstalledInput().input.createStudioGateway(),
gateway: StudioGateway = createTechLogFeatureInstalledInput(MOCK_STUDIO_INSTALL_CONTEXT).input.createStudioGateway(),
navigate: (href: string) => void = () => undefined,
) {
return render(
@@ -151,7 +152,7 @@ describe("TechLog Studio publication flow", () => {
});
it("publishes a current warning preview only after every warning is acknowledged", async () => {
const gateway = createTechLogFeatureInstalledInput().input.createStudioGateway();
const gateway = createTechLogFeatureInstalledInput(MOCK_STUDIO_INSTALL_CONTEXT).input.createStudioGateway();
const document = await warningReadyDocument(gateway);
const destinations: string[] = [];
renderInStudio(
@@ -180,7 +181,7 @@ describe("TechLog Studio publication flow", () => {
it("keeps the publish pending state, preserves gateway command order, and retries with a new key", async () => {
const user = userEvent.setup();
const base = createTechLogFeatureInstalledInput().input.createStudioGateway();
const base = createTechLogFeatureInstalledInput(MOCK_STUDIO_INSTALL_CONTEXT).input.createStudioGateway();
const document = await warningReadyDocument(base);
const first = deferred<never>();
const calls: string[] = [];
@@ -238,7 +239,7 @@ describe("TechLog Studio publication flow", () => {
it("filters publication events and recovers a failed history read", async () => {
const user = userEvent.setup();
const base = createTechLogFeatureInstalledInput().input.createStudioGateway();
const base = createTechLogFeatureInstalledInput(MOCK_STUDIO_INSTALL_CONTEXT).input.createStudioGateway();
const listPublications = vi
.fn<StudioGateway["listPublications"]>()
.mockRejectedValueOnce(new Error("offline"))
@@ -260,7 +261,7 @@ describe("TechLog Studio publication flow", () => {
it("unpublishes only the selected current row after the source confirmation", async () => {
const user = userEvent.setup();
const gateway = createTechLogFeatureInstalledInput().input.createStudioGateway();
const gateway = createTechLogFeatureInstalledInput(MOCK_STUDIO_INSTALL_CONTEXT).input.createStudioGateway();
renderInStudio(<PublicationList />, gateway);
await user.click(
await screen.findByRole("button", { name: /Redis Adapter.*게시 취소/ }),