The best way to control Claude Code, Codex and more from any computer or phone
| 1 | import { ServerSettings } from "@t3tools/contracts"; |
| 2 | import * as Schema from "effect/Schema"; |
| 3 | import { expect, it } from "vite-plus/test"; |
| 4 | |
| 5 | import { secretProviderUses } from "./SecretsSettings.logic"; |
| 6 | |
| 7 | const personal = (reference: string) => ({ provider: "personal", reference }); |
| 8 | const work = { provider: "work", reference: "op://Work/token" }; |
| 9 | |
| 10 | const settings = Schema.decodeSync(ServerSettings)({ |
| 11 | providerInstances: { |
| 12 | antigravity_work: { |
| 13 | driver: "antigravity", |
| 14 | displayName: "Antigravity Work", |
| 15 | environment: [ |
| 16 | { name: "API_TOKEN", value: "", secret: personal("op://a/env") }, |
| 17 | { name: "OTHER_TOKEN", value: "", secret: work }, |
| 18 | ], |
| 19 | }, |
| 20 | codex_plain: { |
| 21 | driver: "codex", |
| 22 | environment: [{ name: "CODEX_TOKEN", value: "", secret: personal("op://c/env") }], |
| 23 | }, |
| 24 | }, |
| 25 | sourceControlHosts: { |
| 26 | github: { tokens: { "github.com": personal("op://gh"), "ghe.acme.test": work } }, |
| 27 | }, |
| 28 | usageLimitSources: { |
| 29 | hub: { kind: "cliproxy", url: "https://hub.test", managementKey: personal("op://hub") }, |
| 30 | }, |
| 31 | easDeviceHosts: [ |
| 32 | { kind: "eas", id: "eas", label: "Expo Simulators", accessToken: personal("op://expo") }, |
| 33 | ], |
| 34 | simlockDeviceHosts: [ |
| 35 | { |
| 36 | kind: "simlock", |
| 37 | id: "pool", |
| 38 | label: "Simlock Pool", |
| 39 | gatewayUrl: "https://simlock.test", |
| 40 | agentToken: personal("op://simlock"), |
| 41 | }, |
| 42 | ], |
| 43 | cloudSpeechCredentials: { openai: personal("op://voice"), xai: "" }, |
| 44 | }); |
| 45 | |
| 46 | it.each([ |
| 47 | [ |
| 48 | "personal", |
| 49 | [ |
| 50 | "Antigravity Work · API_TOKEN", |
| 51 | "Codex · CODEX_TOKEN", |
| 52 | "GitHub · github.com", |
| 53 | "https://hub.test · Management Key", |
| 54 | "Expo Simulators · Access Token", |
| 55 | "Simlock Pool · Agent Token", |
| 56 | "Voice · OpenAI", |
| 57 | ], |
| 58 | ], |
| 59 | ["work", ["Antigravity Work · OTHER_TOKEN", "GitHub · ghe.acme.test"]], |
| 60 | ["unused", []], |
| 61 | ])("lists what reads from secret provider %s", (providerId, uses) => { |
| 62 | expect(secretProviderUses(settings, providerId).map((use) => use.label)).toEqual(uses); |
| 63 | }); |