diff options
Diffstat (limited to 'packages/auth-apikey/src/resolver.test.ts')
| -rw-r--r-- | packages/auth-apikey/src/resolver.test.ts | 58 |
1 files changed, 29 insertions, 29 deletions
diff --git a/packages/auth-apikey/src/resolver.test.ts b/packages/auth-apikey/src/resolver.test.ts index d6c1f85..bef734d 100644 --- a/packages/auth-apikey/src/resolver.test.ts +++ b/packages/auth-apikey/src/resolver.test.ts @@ -2,36 +2,36 @@ import { describe, expect, it } from "vitest"; import { resolveApiKeyCredentials } from "./resolver.js"; describe("resolveApiKeyCredentials", () => { - it("resolves key with default baseURL from minimal env", () => { - const env = { DISPATCH_API_KEY: "sk-test-123" }; - const result = resolveApiKeyCredentials(env); - expect(result).toEqual({ - type: "api-key", - apiKey: "sk-test-123", - baseURL: "https://opencode.ai/zen/go/v1", - }); - }); + it("resolves key with default baseURL from minimal env", () => { + const env = { DISPATCH_API_KEY: "sk-test-123" }; + const result = resolveApiKeyCredentials(env); + expect(result).toEqual({ + type: "api-key", + apiKey: "sk-test-123", + baseURL: "https://opencode.ai/zen/go/v1", + }); + }); - it("honors an explicit DISPATCH_BASE_URL", () => { - const env = { - DISPATCH_API_KEY: "sk-test-456", - DISPATCH_BASE_URL: "https://custom.example.com/v2", - }; - const result = resolveApiKeyCredentials(env); - expect(result).toEqual({ - type: "api-key", - apiKey: "sk-test-456", - baseURL: "https://custom.example.com/v2", - }); - }); + it("honors an explicit DISPATCH_BASE_URL", () => { + const env = { + DISPATCH_API_KEY: "sk-test-456", + DISPATCH_BASE_URL: "https://custom.example.com/v2", + }; + const result = resolveApiKeyCredentials(env); + expect(result).toEqual({ + type: "api-key", + apiKey: "sk-test-456", + baseURL: "https://custom.example.com/v2", + }); + }); - it("throws a clear error when DISPATCH_API_KEY is absent", () => { - const env = {}; - expect(() => resolveApiKeyCredentials(env)).toThrow("DISPATCH_API_KEY"); - }); + it("throws a clear error when DISPATCH_API_KEY is absent", () => { + const env = {}; + expect(() => resolveApiKeyCredentials(env)).toThrow("DISPATCH_API_KEY"); + }); - it("throws when DISPATCH_API_KEY is empty string", () => { - const env = { DISPATCH_API_KEY: "" }; - expect(() => resolveApiKeyCredentials(env)).toThrow("DISPATCH_API_KEY"); - }); + it("throws when DISPATCH_API_KEY is empty string", () => { + const env = { DISPATCH_API_KEY: "" }; + expect(() => resolveApiKeyCredentials(env)).toThrow("DISPATCH_API_KEY"); + }); }); |
