mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-05-12 09:12:40 +02:00
test(web): add Linear OAuth fixture
This commit is contained in:
parent
fb0e12c86c
commit
a60ff02b93
3 changed files with 86 additions and 0 deletions
28
surfsense_web/tests/fixtures/connectors/linear.fixture.ts
vendored
Normal file
28
surfsense_web/tests/fixtures/connectors/linear.fixture.ts
vendored
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
import { type ConnectorRow, deleteConnector, runLinearOAuth } from "../../helpers/api/connectors";
|
||||
import { searchSpaceFixtures } from "../search-space.fixture";
|
||||
|
||||
export type LinearFixtures = {
|
||||
/**
|
||||
* A pre-connected Linear connector inside the fixture's `searchSpace`.
|
||||
* OAuth and MCP tool calls use E2E Linear fakes and are cleaned up
|
||||
* automatically after the test.
|
||||
*/
|
||||
linearConnector: ConnectorRow;
|
||||
};
|
||||
|
||||
export const linearFixtures = searchSpaceFixtures.extend<LinearFixtures>({
|
||||
linearConnector: async ({ request, apiToken, searchSpace }, use) => {
|
||||
const { connector } = await runLinearOAuth(request, apiToken, searchSpace.id);
|
||||
if (!connector) {
|
||||
throw new Error(
|
||||
"linearConnector fixture: OAuth completed but no LINEAR_CONNECTOR was created. " +
|
||||
"Check the backend log — the Linear MCP fake likely rejected an unmodelled call."
|
||||
);
|
||||
}
|
||||
try {
|
||||
await use(connector);
|
||||
} finally {
|
||||
await deleteConnector(request, apiToken, connector.id);
|
||||
}
|
||||
},
|
||||
});
|
||||
8
surfsense_web/tests/fixtures/index.ts
vendored
8
surfsense_web/tests/fixtures/index.ts
vendored
|
|
@ -22,6 +22,8 @@
|
|||
* └─ nativeCalendarWithChatTest — chatThread
|
||||
* └─ notionFixtures — notionConnector
|
||||
* └─ notionWithChatTest — chatThread
|
||||
* └─ linearFixtures — linearConnector
|
||||
* └─ linearWithChatTest — chatThread
|
||||
*
|
||||
* To add a new connector (Gmail, Slack, manual upload, etc.):
|
||||
* 1. Add a fixture file under `fixtures/connectors/<name>.fixture.ts`.
|
||||
|
|
@ -33,6 +35,7 @@ export { chatThreadFixtures } from "./chat-thread.fixture";
|
|||
export { composioCalendarFixtures } from "./connectors/composio-calendar.fixture";
|
||||
export { composioDriveFixtures } from "./connectors/composio-drive.fixture";
|
||||
export { composioGmailFixtures } from "./connectors/composio-gmail.fixture";
|
||||
export { linearFixtures } from "./connectors/linear.fixture";
|
||||
export { nativeCalendarFixtures } from "./connectors/native-calendar.fixture";
|
||||
export { nativeDriveFixtures } from "./connectors/native-drive.fixture";
|
||||
export { nativeGmailFixtures } from "./connectors/native-gmail.fixture";
|
||||
|
|
@ -43,6 +46,7 @@ import { type ChatThreadFixtures, chatThreadFixtures } from "./chat-thread.fixtu
|
|||
import { composioCalendarFixtures } from "./connectors/composio-calendar.fixture";
|
||||
import { composioDriveFixtures } from "./connectors/composio-drive.fixture";
|
||||
import { composioGmailFixtures } from "./connectors/composio-gmail.fixture";
|
||||
import { linearFixtures } from "./connectors/linear.fixture";
|
||||
import { nativeCalendarFixtures } from "./connectors/native-calendar.fixture";
|
||||
import { nativeDriveFixtures } from "./connectors/native-drive.fixture";
|
||||
import { nativeGmailFixtures } from "./connectors/native-gmail.fixture";
|
||||
|
|
@ -85,3 +89,7 @@ export const nativeCalendarWithChatTest =
|
|||
export const notionTest = notionFixtures;
|
||||
/** `test` for Notion specs that also need a chat thread. */
|
||||
export const notionWithChatTest = notionFixtures.extend<ChatThreadFixtures>(chatThreadFixtures);
|
||||
/** `test` for specs that also need a pre-connected Linear connector. */
|
||||
export const linearTest = linearFixtures;
|
||||
/** `test` for Linear specs that also need a chat thread. */
|
||||
export const linearWithChatTest = linearFixtures.extend<ChatThreadFixtures>(chatThreadFixtures);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue