2025-06-27 23:33:26 +02:00
|
|
|
import playwrightConfig from '../playwright.config';
|
2025-05-22 22:02:44 +02:00
|
|
|
|
|
|
|
|
export async function cleanupBackend() {
|
2025-06-27 23:33:26 +02:00
|
|
|
const url = new URL('/api/test/reset', playwrightConfig.use!.baseURL);
|
2025-06-06 03:23:51 -07:00
|
|
|
|
2025-06-27 23:33:26 +02:00
|
|
|
if (process.env.SKIP_LDAP_TESTS === 'true') {
|
|
|
|
|
url.searchParams.append('skip-ldap', 'true');
|
|
|
|
|
}
|
2025-06-06 03:23:51 -07:00
|
|
|
|
2025-06-27 23:33:26 +02:00
|
|
|
const response = await fetch(url, {
|
|
|
|
|
method: 'POST'
|
|
|
|
|
});
|
2025-05-22 22:02:44 +02:00
|
|
|
|
2025-06-27 23:33:26 +02:00
|
|
|
if (!response.ok) {
|
|
|
|
|
throw new Error(`Failed to reset backend: ${response.status} ${response.statusText}`);
|
|
|
|
|
}
|
2025-05-22 22:02:44 +02:00
|
|
|
}
|