From f477da48ecd23e5ff195a1b671575ae77c29b508 Mon Sep 17 00:00:00 2001 From: kolaente Date: Fri, 3 Apr 2026 20:50:59 +0200 Subject: [PATCH] feat: add Factory.truncateAll() helper for e2e tests --- frontend/tests/support/factory.ts | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/frontend/tests/support/factory.ts b/frontend/tests/support/factory.ts index c1b8b2496..d0d0196e4 100644 --- a/frontend/tests/support/factory.ts +++ b/frontend/tests/support/factory.ts @@ -96,4 +96,17 @@ export class Factory { static async truncate() { await this.seed(this.table, null) } + + static async truncateAll() { + const response = await this.request.delete('test/all', { + headers: { + 'Authorization': process.env.VIKUNJA_SERVICE_TESTINGTOKEN || 'averyLongSecretToSe33dtheDB', + }, + }) + + if (!response.ok()) { + const body = await response.json() + throw new Error(`Failed to truncate all tables (${response.status()}): ${body.message}`) + } + } }