Files
pocket-id-pocket-id-2/tests/utils/cleanup.util.ts
2025-06-27 23:33:26 +02:00

18 lines
442 B
TypeScript

import playwrightConfig from '../playwright.config';
export async function cleanupBackend() {
const url = new URL('/api/test/reset', playwrightConfig.use!.baseURL);
if (process.env.SKIP_LDAP_TESTS === 'true') {
url.searchParams.append('skip-ldap', 'true');
}
const response = await fetch(url, {
method: 'POST'
});
if (!response.ok) {
throw new Error(`Failed to reset backend: ${response.status} ${response.statusText}`);
}
}