mirror of
https://github.com/pocket-id/pocket-id.git
synced 2025-12-17 01:11:38 +03:00
Co-authored-by: Alessandro (Ale) Segala <43508+ItalyPaleAle@users.noreply.github.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
22 lines
588 B
TypeScript
22 lines
588 B
TypeScript
import playwrightConfig from '../playwright.config';
|
|
|
|
export async function cleanupBackend({ skipSeed = false, skipLdapSetup = false } = {}) {
|
|
const url = new URL('/api/test/reset', playwrightConfig.use!.baseURL);
|
|
|
|
if (process.env.SKIP_LDAP_TESTS === 'true' || skipSeed || skipLdapSetup) {
|
|
url.searchParams.append('skip-ldap', 'true');
|
|
}
|
|
|
|
if (skipSeed) {
|
|
url.searchParams.append('skip-seed', 'true');
|
|
}
|
|
|
|
const response = await fetch(url, {
|
|
method: 'POST'
|
|
});
|
|
|
|
if (!response.ok) {
|
|
throw new Error(`Failed to reset backend: ${response.status} ${response.statusText}`);
|
|
}
|
|
}
|