refactor: 템플릿에서 기본적으로 제공하고 있는 워크 플로우에 디자인과 라우팅 흡수
This commit is contained in:
@@ -615,6 +615,52 @@ describe("application mutation reconciliation bridge", () => {
|
||||
expect(invalidateQueries).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("uses a canonical identity projection without changing the bound transport input", async () => {
|
||||
const client = queryClient();
|
||||
const scope = scopeSnapshot();
|
||||
const file = new File(["payload"], "diagram.svg", {
|
||||
type: "image/svg+xml",
|
||||
});
|
||||
const input = { file, stableId: "diagram.svg:7" };
|
||||
const execute = vi.fn(
|
||||
async (
|
||||
received: typeof input,
|
||||
context: Readonly<{
|
||||
signal: AbortSignal;
|
||||
intent: import("../../src/contracts/mutation-intent.ts").MutationIntent;
|
||||
}>,
|
||||
) => {
|
||||
expect(received.file).toBe(file);
|
||||
expect(context.intent.idempotencyKey).toBeTruthy();
|
||||
return { ok: true as const, value: received.stableId };
|
||||
},
|
||||
);
|
||||
const hook = renderHook(
|
||||
() =>
|
||||
useApplicationMutation<typeof input, string>({
|
||||
definitionId: "host-object-identity-v1",
|
||||
definitionVersion: 1,
|
||||
operationId: "UPLOAD",
|
||||
requiresIdempotencyKey: true,
|
||||
owner: "platform-test",
|
||||
duplicatePolicy: "REJECT_WHILE_ACTIVE",
|
||||
scope,
|
||||
identity: (value) => ({ stableId: value.stableId }),
|
||||
execute,
|
||||
invalidate: [],
|
||||
}),
|
||||
{ wrapper: wrapper(client) },
|
||||
);
|
||||
|
||||
let outcome: ApplicationResult<string> | undefined;
|
||||
await act(async () => {
|
||||
outcome = await hook.result.current.submit(input);
|
||||
});
|
||||
|
||||
expect(outcome).toEqual({ ok: true, value: "diagram.svg:7" });
|
||||
expect(execute).toHaveBeenCalledOnce();
|
||||
});
|
||||
|
||||
it("restores a bound unknown-effect head after controller remount", async () => {
|
||||
const client = queryClient();
|
||||
const scope = scopeSnapshot();
|
||||
|
||||
@@ -13,6 +13,7 @@ describe("async UI state matrix", () => {
|
||||
[{ isInitialLoading: true }, "initial-loading"],
|
||||
[{ data: [{ id: "1" }] }, "success"],
|
||||
[{ data: [] }, "empty"],
|
||||
[{ data: null }, "empty"],
|
||||
[
|
||||
{ failure: createFailure("SERVER_FAILURE", "LIST", 0) },
|
||||
"terminal-error",
|
||||
|
||||
Reference in New Issue
Block a user