mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-05-13 17:52:38 +02:00
test(web): add Jira OAuth fixture
This commit is contained in:
parent
ebdf6cbaed
commit
ddfbe0b611
3 changed files with 86 additions and 0 deletions
28
surfsense_web/tests/fixtures/connectors/jira.fixture.ts
vendored
Normal file
28
surfsense_web/tests/fixtures/connectors/jira.fixture.ts
vendored
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
import { type ConnectorRow, deleteConnector, runJiraOAuth } from "../../helpers/api/connectors";
|
||||
import { searchSpaceFixtures } from "../search-space.fixture";
|
||||
|
||||
export type JiraFixtures = {
|
||||
/**
|
||||
* A pre-connected Jira connector inside the fixture's `searchSpace`.
|
||||
* OAuth and MCP tool calls use E2E Jira fakes and are cleaned up
|
||||
* automatically after the test.
|
||||
*/
|
||||
jiraConnector: ConnectorRow;
|
||||
};
|
||||
|
||||
export const jiraFixtures = searchSpaceFixtures.extend<JiraFixtures>({
|
||||
jiraConnector: async ({ request, apiToken, searchSpace }, use) => {
|
||||
const { connector } = await runJiraOAuth(request, apiToken, searchSpace.id);
|
||||
if (!connector) {
|
||||
throw new Error(
|
||||
"jiraConnector fixture: OAuth completed but no JIRA_CONNECTOR was created. " +
|
||||
"Check the backend log — the Jira MCP 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