Files
perauset-e2e-mrg0et1k/e2e/tests/steps/audit-log.steps.ts
2026-07-11 08:54:43 +02:00

13 lines
733 B
TypeScript

import { Then } from '@cucumber/cucumber'
import { strict as assert } from 'assert'
import type { PerausetWorld } from '../support/world.js'
Then('the audit log should contain an {string} entry for table {string}', function (this: PerausetWorld, action: string, tableName: string) {
assert.ok(this.lastBody, 'No response body')
assert.ok(Array.isArray(this.lastBody.items), `Expected body.items to be an array, got: ${JSON.stringify(this.lastBody)}`)
const match = this.lastBody.items.find(
(entry: any) => entry.action === action && entry.tableName === tableName
)
assert.ok(match, `No audit log entry with action="${action}" for table="${tableName}" found in: ${JSON.stringify(this.lastBody.items.slice(0, 5))}`)
})