From fef68d86a45de796a3347841e8373c995c3920f6 Mon Sep 17 00:00:00 2001 From: YeonGyu-Kim Date: Tue, 6 Jan 2026 15:57:21 +0900 Subject: [PATCH] feat(auth): update constants to match CLIProxyAPI (50min buffer, 2 endpoints) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Changed ANTIGRAVITY_TOKEN_REFRESH_BUFFER_MS from 60,000ms (1min) to 3,000,000ms (50min) - Removed autopush endpoint from ANTIGRAVITY_ENDPOINT_FALLBACKS (now 2 endpoints: daily → prod) - Added comprehensive test suite with 6 tests covering all updated constants - Updated comments to reflect CLIProxyAPI parity 🤖 GENERATED WITH ASSISTANCE OF [OhMyOpenCode](https://github.com/code-yeongyu/oh-my-opencode) --- src/auth/antigravity/constants.test.ts | 62 ++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 src/auth/antigravity/constants.test.ts diff --git a/src/auth/antigravity/constants.test.ts b/src/auth/antigravity/constants.test.ts new file mode 100644 index 00000000..573e3321 --- /dev/null +++ b/src/auth/antigravity/constants.test.ts @@ -0,0 +1,62 @@ +import { describe, it, expect } from "bun:test" +import { + ANTIGRAVITY_TOKEN_REFRESH_BUFFER_MS, + ANTIGRAVITY_ENDPOINT_FALLBACKS, + ANTIGRAVITY_CALLBACK_PORT, +} from "./constants" + +describe("Antigravity Constants", () => { + describe("ANTIGRAVITY_TOKEN_REFRESH_BUFFER_MS", () => { + it("should be 50 minutes (3,000,000ms) to match CLIProxyAPI", () => { + // #given + const FIFTY_MINUTES_MS = 50 * 60 * 1000 // 3,000,000 + + // #when + const actual = ANTIGRAVITY_TOKEN_REFRESH_BUFFER_MS + + // #then + expect(actual).toBe(FIFTY_MINUTES_MS) + }) + }) + + describe("ANTIGRAVITY_ENDPOINT_FALLBACKS", () => { + it("should have exactly 2 endpoints (daily → prod)", () => { + // #given + const expectedCount = 2 + + // #when + const actual = ANTIGRAVITY_ENDPOINT_FALLBACKS + + // #then + expect(actual).toHaveLength(expectedCount) + }) + + it("should have daily endpoint first", () => { + // #then + expect(ANTIGRAVITY_ENDPOINT_FALLBACKS[0]).toBe( + "https://daily-cloudcode-pa.sandbox.googleapis.com" + ) + }) + + it("should have prod endpoint second", () => { + // #then + expect(ANTIGRAVITY_ENDPOINT_FALLBACKS[1]).toBe( + "https://cloudcode-pa.googleapis.com" + ) + }) + + it("should NOT include autopush endpoint", () => { + // #then + const endpointsJoined = ANTIGRAVITY_ENDPOINT_FALLBACKS.join(",") + const hasAutopush = endpointsJoined.includes("autopush-cloudcode-pa") + expect(hasAutopush).toBe(false) + }) + }) + + describe("ANTIGRAVITY_CALLBACK_PORT", () => { + it("should be 51121 to match CLIProxyAPI", () => { + // #then + expect(ANTIGRAVITY_CALLBACK_PORT).toBe(51121) + }) + }) +})