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, 06:00 UTC
| 1 | import { describe, expect, it } from "vitest"; |
| 2 | import { makeDeployTarget } from "../../core/index.ts"; |
| 3 | import { DEFAULT_TARGET_SPECIFIER, isVocsTarget, selectVocsTargetInput } from "../Target.ts"; |
| 4 | |
| 5 | describe("Vocs target selection", () => { |
| 6 | it("uses the Vocs Cloudflare target by default", () => { |
| 7 | expect(selectVocsTargetInput()).toEqual({ |
| 8 | input: DEFAULT_TARGET_SPECIFIER, |
| 9 | config: undefined, |
| 10 | }); |
| 11 | }); |
| 12 | |
| 13 | it("unwraps the E2E harness Cloudflare worker configuration", () => { |
| 14 | const worker = { compatibilityDate: "2026-03-10" }; |
| 15 | expect(selectVocsTargetInput({ target: { cloudflare: { worker } } })).toEqual({ |
| 16 | input: DEFAULT_TARGET_SPECIFIER, |
| 17 | config: worker, |
| 18 | }); |
| 19 | }); |
| 20 | |
| 21 | it("preserves an explicit target and its factory configuration", () => { |
| 22 | const factory = () => |
| 23 | makeDeployTarget({ |
| 24 | platform: "test", |
| 25 | config: undefined, |
| 26 | adapter: () => { |
| 27 | throw new Error("not called"); |
| 28 | }, |
| 29 | vitePlugins: () => { |
| 30 | throw new Error("not called"); |
| 31 | }, |
| 32 | }); |
| 33 | const config = { region: "test" }; |
| 34 | expect(selectVocsTargetInput({ target: factory, vite: config })).toEqual({ |
| 35 | input: factory, |
| 36 | config, |
| 37 | }); |
| 38 | }); |
| 39 | |
| 40 | it("recognizes only deploy targets with the Waku runtime hooks", () => { |
| 41 | expect( |
| 42 | isVocsTarget( |
| 43 | makeDeployTarget({ |
| 44 | platform: "test", |
| 45 | config: undefined, |
| 46 | adapter: () => { |
| 47 | throw new Error("not called"); |
| 48 | }, |
| 49 | vitePlugins: () => { |
| 50 | throw new Error("not called"); |
| 51 | }, |
| 52 | }), |
| 53 | ), |
| 54 | ).toBe(true); |
| 55 | expect(isVocsTarget(makeDeployTarget({ platform: "test", config: undefined }))).toBe(false); |
| 56 | }); |
| 57 | }); |