Files
openclaw/extensions/google/oauth-token-shared.test.ts
Vincent Koc fcc20d14a3 fix(google): stop scraping Gemini CLI OAuth credentials (#117167)
* fix(google): delegate Gemini OAuth refresh to the CLI

* refactor(google): remove retired Gemini OAuth stack

* chore(ci): prune retired Google OAuth baseline

* fix(google): retire Gemini CLI usage telemetry

* fix(google): remove retired usage token parser
2026-08-01 11:36:24 +08:00

29 lines
947 B
TypeScript

// Google tests cover oauth token shared plugin behavior.
import { describe, expect, it } from "vitest";
import { formatGoogleOauthApiKey, parseGoogleOauthApiKey } from "./oauth-token-shared.js";
describe("google oauth token helpers", () => {
it("formats oauth credentials with project-aware payloads", () => {
expect(
formatGoogleOauthApiKey({
type: "oauth",
access: "token-123",
projectId: "project-abc",
}),
).toBe(JSON.stringify({ token: "token-123", projectId: "project-abc" }));
});
it("returns an empty string for non-oauth credentials", () => {
expect(formatGoogleOauthApiKey({ type: "token", access: "token-123" })).toBe("");
});
it("parses structured oauth payload fields", () => {
expect(
parseGoogleOauthApiKey(JSON.stringify({ token: "usage-token", projectId: "proj-1" })),
).toEqual({
token: "usage-token",
projectId: "proj-1",
});
});
});