mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 19:20:43 +00:00
57 lines
2.1 KiB
TypeScript
57 lines
2.1 KiB
TypeScript
import { describe, expect, it } from "vitest";
|
|
import { isLiveTestEnabled } from "../../src/agents/live-test-helpers.js";
|
|
import { fetchGoogleMeetArtifacts, fetchLatestGoogleMeetConferenceRecord } from "./src/meet.js";
|
|
import { resolveGoogleMeetAccessToken } from "./src/oauth.js";
|
|
|
|
const LIVE_MEETING = process.env.OPENCLAW_GOOGLE_MEET_LIVE_MEETING?.trim() ?? "";
|
|
const CLIENT_ID =
|
|
process.env.OPENCLAW_GOOGLE_MEET_CLIENT_ID?.trim() ??
|
|
process.env.GOOGLE_MEET_CLIENT_ID?.trim() ??
|
|
"";
|
|
const CLIENT_SECRET =
|
|
process.env.OPENCLAW_GOOGLE_MEET_CLIENT_SECRET?.trim() ??
|
|
process.env.GOOGLE_MEET_CLIENT_SECRET?.trim();
|
|
const REFRESH_TOKEN =
|
|
process.env.OPENCLAW_GOOGLE_MEET_REFRESH_TOKEN?.trim() ??
|
|
process.env.GOOGLE_MEET_REFRESH_TOKEN?.trim() ??
|
|
"";
|
|
const ACCESS_TOKEN =
|
|
process.env.OPENCLAW_GOOGLE_MEET_ACCESS_TOKEN?.trim() ??
|
|
process.env.GOOGLE_MEET_ACCESS_TOKEN?.trim();
|
|
const EXPIRES_AT = Number(
|
|
process.env.OPENCLAW_GOOGLE_MEET_ACCESS_TOKEN_EXPIRES_AT ??
|
|
process.env.GOOGLE_MEET_ACCESS_TOKEN_EXPIRES_AT,
|
|
);
|
|
|
|
const LIVE =
|
|
isLiveTestEnabled() &&
|
|
LIVE_MEETING.length > 0 &&
|
|
((CLIENT_ID.length > 0 && REFRESH_TOKEN.length > 0) || Boolean(ACCESS_TOKEN));
|
|
const describeLive = LIVE ? describe : describe.skip;
|
|
|
|
describeLive("google-meet live", () => {
|
|
it("resolves latest conference record and artifacts for a real meeting", async () => {
|
|
const token = await resolveGoogleMeetAccessToken({
|
|
clientId: CLIENT_ID,
|
|
clientSecret: CLIENT_SECRET,
|
|
refreshToken: REFRESH_TOKEN,
|
|
accessToken: ACCESS_TOKEN,
|
|
expiresAt: Number.isFinite(EXPIRES_AT) ? EXPIRES_AT : undefined,
|
|
});
|
|
|
|
const latest = await fetchLatestGoogleMeetConferenceRecord({
|
|
accessToken: token.accessToken,
|
|
meeting: LIVE_MEETING,
|
|
});
|
|
expect(latest.space.name).toMatch(/^spaces\//);
|
|
|
|
const artifacts = await fetchGoogleMeetArtifacts({
|
|
accessToken: token.accessToken,
|
|
meeting: LIVE_MEETING,
|
|
pageSize: 5,
|
|
});
|
|
expect(artifacts.conferenceRecords.length).toBeLessThanOrEqual(1);
|
|
expect(Array.isArray(artifacts.artifacts)).toBe(true);
|
|
}, 120_000);
|
|
});
|