mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-05-13 17:52:38 +02:00
test(web): add Composio Calendar live-tool journey
This commit is contained in:
parent
bc2dc21a75
commit
0a62dc189c
3 changed files with 101 additions and 0 deletions
33
surfsense_web/tests/fixtures/connectors/composio-calendar.fixture.ts
vendored
Normal file
33
surfsense_web/tests/fixtures/connectors/composio-calendar.fixture.ts
vendored
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
import { type ConnectorRow, deleteConnector, runComposioOAuth } from "../../helpers/api/connectors";
|
||||
import { searchSpaceFixtures } from "../search-space.fixture";
|
||||
|
||||
export type ComposioCalendarFixtures = {
|
||||
/**
|
||||
* A pre-connected Composio Google Calendar connector inside the
|
||||
* fixture's `searchSpace`. OAuth uses the strict fake and is cleaned
|
||||
* up automatically after the test.
|
||||
*/
|
||||
composioCalendarConnector: ConnectorRow;
|
||||
};
|
||||
|
||||
export const composioCalendarFixtures = searchSpaceFixtures.extend<ComposioCalendarFixtures>({
|
||||
composioCalendarConnector: async ({ request, apiToken, searchSpace }, use) => {
|
||||
const { connector } = await runComposioOAuth(
|
||||
request,
|
||||
apiToken,
|
||||
searchSpace.id,
|
||||
"googlecalendar"
|
||||
);
|
||||
if (!connector) {
|
||||
throw new Error(
|
||||
"composioCalendarConnector fixture: OAuth completed but no connector was created. " +
|
||||
"Check the backend log — the strict Composio fake likely rejected an unmodelled call."
|
||||
);
|
||||
}
|
||||
try {
|
||||
await use(connector);
|
||||
} finally {
|
||||
await deleteConnector(request, apiToken, connector.id);
|
||||
}
|
||||
},
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue