chore: perauset customer project
This commit is contained in:
19
e2e/tests/steps/shared.steps.ts
Normal file
19
e2e/tests/steps/shared.steps.ts
Normal file
@@ -0,0 +1,19 @@
|
||||
import { When, Then } from '@cucumber/cucumber'
|
||||
import { strict as assert } from 'assert'
|
||||
import type { PerausetWorld } from '../support/world.js'
|
||||
|
||||
When('I send a POST request to {string} with body:', async function (this: PerausetWorld, path: string, body: string) {
|
||||
await this.post(path, JSON.parse(body))
|
||||
})
|
||||
|
||||
Then('I store the response field {string} as {string}', function (this: PerausetWorld, field: string, key: string) {
|
||||
assert.ok(this.lastBody, 'No response body')
|
||||
const value = this.lastBody[field]
|
||||
assert.ok(value !== undefined && value !== null, `Response body field "${field}" is missing. Body: ${JSON.stringify(this.lastBody)}`)
|
||||
;(this as any)[key] = value
|
||||
})
|
||||
|
||||
Then('the response body field {string} should be truthy', function (this: PerausetWorld, field: string) {
|
||||
assert.ok(this.lastBody, 'No response body')
|
||||
assert.ok(this.lastBody[field], `Expected body.${field} to be truthy, got: ${JSON.stringify(this.lastBody[field])}`)
|
||||
})
|
||||
Reference in New Issue
Block a user