test(web): assert Gmail journey uses live tools only

This commit is contained in:
Anish Sarkar 2026-05-07 03:16:20 +05:30
parent 7864cbbeea
commit a2af4be359
2 changed files with 24 additions and 85 deletions

View file

@ -20,9 +20,7 @@ export async function listConnectors(
{ headers: authHeaders(token) }
);
if (!response.ok()) {
throw new Error(
`listConnectors failed (${response.status()}): ${await response.text()}`
);
throw new Error(`listConnectors failed (${response.status()}): ${await response.text()}`);
}
const data = await response.json();
return Array.isArray(data) ? data : (data?.items ?? []);
@ -128,35 +126,6 @@ export async function triggerIndex(
return { ok: true };
}
export async function triggerIndexByDateRange(
request: APIRequestContext,
token: string,
connectorId: number,
searchSpaceId: number,
options: { startDate?: string; endDate?: string } = {}
): Promise<{ ok: true }> {
const params = new URLSearchParams({ search_space_id: String(searchSpaceId) });
if (options.startDate) params.set("start_date", options.startDate);
if (options.endDate) params.set("end_date", options.endDate);
const response = await request.post(
`${BACKEND_URL}/api/v1/search-source-connectors/${connectorId}/index?${params.toString()}`,
{ headers: authHeaders(token) }
);
if (!response.ok()) {
throw new Error(
`triggerIndexByDateRange(${connectorId}) failed (${response.status()}): ${await response.text()}`
);
}
const body = (await response.json()) as { indexing_started?: boolean; message?: string };
if (body.indexing_started === false) {
throw new Error(
`triggerIndexByDateRange(${connectorId}) did not start indexing: ${body.message ?? "no message"}`
);
}
return { ok: true };
}
/**
* Drives the OAuth flow for a Composio toolkit programmatically.
*
@ -215,8 +184,7 @@ export async function runComposioOAuth(
: toolkitId === "gmail"
? "COMPOSIO_GMAIL_CONNECTOR"
: "COMPOSIO_GOOGLE_CALENDAR_CONNECTOR";
const connector =
connectors.find((c) => c.connector_type === composioType) ?? null;
const connector = connectors.find((c) => c.connector_type === composioType) ?? null;
return { authUrl: auth_url, finalUrl: location, connector };
}