Testy e2e: resetDb czysci seed, test-all w Justfile; db.json 56 rezerwacji na 2 tygodnie
This commit is contained in:
10
test_rms.mjs
10
test_rms.mjs
@@ -29,6 +29,16 @@ async function resetDb() {
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify(body),
|
||||
});
|
||||
|
||||
// Delete any reservations created by previous test runs (not part of seed r1–r56).
|
||||
const seedIds = new Set(Array.from({ length: 56 }, (_, i) => `r${i + 1}`));
|
||||
const all = await fetch(`${api}/reservations`).then((r) => r.json()).catch(() => []);
|
||||
await Promise.all(
|
||||
all
|
||||
.filter((r) => !seedIds.has(r.id))
|
||||
.map((r) => fetch(`${api}/reservations/${r.id}`, { method: 'DELETE' }))
|
||||
);
|
||||
|
||||
// Ensure r1 and r2 are pending so admin-confirm test always finds a button.
|
||||
await patch('r1', { status: 'pending' });
|
||||
await patch('r2', { status: 'pending' });
|
||||
|
||||
Reference in New Issue
Block a user