13 lines
733 B
TypeScript
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))}`)
|
|
})
|