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