feat(auth): update constants to match CLIProxyAPI (50min buffer, 2 endpoints)

- 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)
This commit is contained in:
YeonGyu-Kim 2026-01-06 15:57:21 +09:00
parent 2073515762
commit fef68d86a4

View File

@ -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)
})
})
})