Skip to content

Commit 4e94050

Browse files
test(mobile): the upload worker test fakes only the RPC transport
It replaced client-runtime's whole runtime module with a hand-written mock that had no settlePromise, so once the worker settled uploads with it every upload failed. The mock now spreads the real module. Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent 913e2e0 commit 4e94050

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

‎apps/mobile/src/state/composer-attachment-uploads.test.ts‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,10 @@ vi.mock("./attachments", () => ({
135135
attachmentEnvironment: { createUploadUrl: native.mint, remove: native.remove },
136136
}));
137137
vi.mock("./assets", () => ({ assetEnvironment: { createUrl: (input: unknown) => input } }));
138-
vi.mock("@t3tools/client-runtime/state/runtime", () => ({
138+
vi.mock("@t3tools/client-runtime/state/runtime", async (importOriginal) => ({
139+
// The worker settles uploads with the real settlePromise and squashAtomCommandFailure;
140+
// only the RPC transport is substituted.
141+
...(await importOriginal<typeof import("@t3tools/client-runtime/state/runtime")>()),
139142
createEnvironmentRpcCommand: () => Symbol("rpc-command"),
140143
executeAtomQuery: async (
141144
_registry: unknown,
@@ -164,7 +167,6 @@ vi.mock("@t3tools/client-runtime/state/runtime", () => ({
164167
}
165168
throw new Error("Unexpected RPC command");
166169
},
167-
squashAtomCommandFailure: (result: { error: unknown }) => result.error,
168170
}));
169171
vi.mock("./use-thread-outbox", async () => {
170172
const { Atom } = await import("effect/reactivity");

0 commit comments

Comments
 (0)