2026-05-06 17:21:40 +05:30
|
|
|
import { randomUUID } from "node:crypto";
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Canary tokens & deterministic test data.
|
|
|
|
|
*
|
|
|
|
|
* Embedded by the backend Composio fake into fake Drive file contents
|
|
|
|
|
* (see surfsense_backend/tests/e2e/fakes/fixtures/drive_files.json).
|
|
|
|
|
* Specs assert these strings appear in the resulting Document rows to
|
|
|
|
|
* prove the indexing pipeline ran end-to-end.
|
|
|
|
|
*
|
|
|
|
|
* Each token is a stable string keyed by file id so multi-test runs
|
|
|
|
|
* remain deterministic and the resulting Document.content is greppable
|
|
|
|
|
* in failure traces.
|
|
|
|
|
*/
|
|
|
|
|
export const CANARY_TOKENS = {
|
|
|
|
|
driveCanaryFile: "SURFSENSE_E2E_CANARY_TOKEN_DRIVE_001",
|
|
|
|
|
driveReadme: "SURFSENSE_E2E_README_MARKER",
|
|
|
|
|
driveBudget: "SURFSENSE_E2E_BUDGET_MARKER",
|
|
|
|
|
driveRoadmap: "SURFSENSE_E2E_ROADMAP_MARKER",
|
|
|
|
|
driveArchive: "SURFSENSE_E2E_ARCHIVE_MARKER",
|
2026-05-07 02:52:41 +05:30
|
|
|
gmailCanary: "SURFSENSE_E2E_CANARY_TOKEN_GMAIL_001",
|
2026-05-07 03:41:47 +05:30
|
|
|
calendarCanary: "SURFSENSE_E2E_CANARY_TOKEN_CALENDAR_001",
|
2026-05-07 22:22:43 +05:30
|
|
|
notionCanary: "SURFSENSE_E2E_CANARY_TOKEN_NOTION_001",
|
2026-05-06 17:21:40 +05:30
|
|
|
} as const;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Fake Drive file IDs that match what the backend fake returns from
|
|
|
|
|
* GOOGLEDRIVE_LIST_FILES. Keep in sync with drive_files.json.
|
|
|
|
|
*/
|
|
|
|
|
export const FAKE_DRIVE_FILES = {
|
|
|
|
|
canary: { id: "fake-file-canary", name: "e2e-canary.txt", mimeType: "text/plain" },
|
|
|
|
|
readme: { id: "fake-file-readme", name: "README.md", mimeType: "text/markdown" },
|
|
|
|
|
budget: { id: "fake-file-budget", name: "Q1-Budget.csv", mimeType: "text/csv" },
|
|
|
|
|
} as const;
|
|
|
|
|
|
|
|
|
|
export const FAKE_DRIVE_FOLDERS = {
|
|
|
|
|
projects: {
|
|
|
|
|
id: "fake-folder-projects",
|
|
|
|
|
name: "Projects",
|
|
|
|
|
mimeType: "application/vnd.google-apps.folder",
|
|
|
|
|
},
|
|
|
|
|
archive: {
|
|
|
|
|
id: "fake-folder-archive",
|
|
|
|
|
name: "Archive",
|
|
|
|
|
mimeType: "application/vnd.google-apps.folder",
|
|
|
|
|
},
|
|
|
|
|
} as const;
|
|
|
|
|
|
2026-05-07 02:52:41 +05:30
|
|
|
/**
|
|
|
|
|
* Fake Gmail message IDs that match what the backend fake returns from
|
|
|
|
|
* GMAIL_FETCH_EMAILS / GMAIL_FETCH_MESSAGE_BY_MESSAGE_ID.
|
|
|
|
|
*/
|
|
|
|
|
export const FAKE_GMAIL_MESSAGES = {
|
|
|
|
|
canary: {
|
|
|
|
|
id: "fake-msg-canary-001",
|
|
|
|
|
threadId: "fake-thread-canary-001",
|
|
|
|
|
subject: "E2E Canary Email",
|
|
|
|
|
from: "sender@surfsense.example",
|
|
|
|
|
to: "e2e-fake@surfsense.example",
|
|
|
|
|
},
|
|
|
|
|
planning: {
|
|
|
|
|
id: "fake-msg-planning-001",
|
|
|
|
|
threadId: "fake-thread-planning-001",
|
|
|
|
|
subject: "E2E Planning Notes",
|
|
|
|
|
from: "planner@surfsense.example",
|
|
|
|
|
to: "e2e-fake@surfsense.example",
|
|
|
|
|
},
|
|
|
|
|
} as const;
|
|
|
|
|
|
2026-05-07 03:41:47 +05:30
|
|
|
/**
|
|
|
|
|
* Fake Calendar event IDs that match what the backend fake returns from
|
|
|
|
|
* GOOGLECALENDAR_EVENTS_LIST.
|
|
|
|
|
*/
|
|
|
|
|
export const FAKE_CALENDAR_EVENTS = {
|
|
|
|
|
canary: {
|
|
|
|
|
id: "fake-calendar-event-canary-001",
|
|
|
|
|
summary: "E2E Canary Calendar Event",
|
|
|
|
|
location: "SurfSense E2E Room",
|
|
|
|
|
},
|
|
|
|
|
planning: {
|
|
|
|
|
id: "fake-calendar-event-planning-001",
|
|
|
|
|
summary: "E2E Planning Sync",
|
|
|
|
|
location: "SurfSense Planning Room",
|
|
|
|
|
},
|
|
|
|
|
} as const;
|
|
|
|
|
|
2026-05-07 22:22:43 +05:30
|
|
|
/**
|
|
|
|
|
* Fake Notion page IDs that match what the backend fake returns from
|
|
|
|
|
* notion_client.AsyncClient.search.
|
|
|
|
|
*/
|
|
|
|
|
export const FAKE_NOTION_PAGES = {
|
|
|
|
|
canary: {
|
|
|
|
|
id: "fake-notion-page-canary-001",
|
|
|
|
|
title: "E2E Canary Notion Page",
|
|
|
|
|
workspaceId: "fake-notion-workspace-001",
|
|
|
|
|
workspaceName: "SurfSense E2E Notion Workspace",
|
|
|
|
|
botId: "fake-notion-bot-001",
|
|
|
|
|
},
|
|
|
|
|
} as const;
|
|
|
|
|
|
2026-05-06 17:21:40 +05:30
|
|
|
/** Generate a unique-per-run search space name. Keeps parallel tests isolated. */
|
|
|
|
|
export function uniqueSearchSpaceName(prefix = "e2e"): string {
|
|
|
|
|
return `${prefix}-${randomUUID().slice(0, 8)}`;
|
|
|
|
|
}
|