The best way to control Claude Code, Codex and more from any computer or phone
Mirrored from https://github.com/Camo67/t3code.git
Synced Nov 21, 04:45 UTC
| 1 | import { describe, expect, it, vi } from "@effect/vitest"; |
| 2 | import type { SharePayload } from "expo-sharing"; |
| 3 | |
| 4 | import { createIncomingSharePayloadReader } from "./incoming-share-native"; |
| 5 | |
| 6 | describe("createIncomingSharePayloadReader", () => { |
| 7 | it("treats a missing iOS App Group as an unavailable inbox", () => { |
| 8 | const readPayloads = vi.fn((): ReadonlyArray<SharePayload> => { |
| 9 | throw Object.assign(new Error("Expo-sharing has failed to fetch the app group id"), { |
| 10 | code: "ERR_FAILED_TO_RESOLVE_APP_GROUP_ID", |
| 11 | }); |
| 12 | }); |
| 13 | const read = createIncomingSharePayloadReader({ platform: "ios", readPayloads }); |
| 14 | |
| 15 | expect(read()).toEqual([]); |
| 16 | expect(read()).toEqual([]); |
| 17 | expect(readPayloads).toHaveBeenCalledTimes(1); |
| 18 | }); |
| 19 | |
| 20 | // regression: #4943 stop shared content errors in Personal Team builds |
| 21 | it("preserves other native errors", () => { |
| 22 | const error = new Error("native failure"); |
| 23 | const read = createIncomingSharePayloadReader({ |
| 24 | platform: "ios", |
| 25 | readPayloads: () => { |
| 26 | throw error; |
| 27 | }, |
| 28 | }); |
| 29 | |
| 30 | expect(read).toThrow(error); |
| 31 | }); |
| 32 | }); |