feat: add Factory.truncateAll() helper for e2e tests

This commit is contained in:
kolaente 2026-04-03 20:50:59 +02:00 committed by kolaente
parent e9a26b9088
commit f477da48ec
1 changed files with 13 additions and 0 deletions

View File

@ -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}`)
}
}
}