Files
perauset-e2e-mrfzot2p/e2e/tests/steps/finance.steps.ts
2026-07-11 08:34:30 +02:00

39 lines
1.2 KiB
TypeScript

import { When } from '@cucumber/cucumber'
import type { PerausetWorld } from '../support/world.js'
When('I create a finance record {string} with amount {int} and type {string}', async function (this: PerausetWorld, name: string, amount: number, recordType: string) {
await this.post('/finance', {
name,
amount,
recordType,
category: 'operations',
})
})
When('I list finance records', async function (this: PerausetWorld) {
await this.get('/finance')
})
When('I update the finance record with name {string}', async function (this: PerausetWorld, name: string) {
const financeId = (this as any).financeId
await this.put(`/finance/${financeId}`, {
financeId,
name,
})
})
When('I link the finance record to entity type {string}', async function (this: PerausetWorld, entityType: string) {
const financeId = (this as any).financeId
const entityId = (this as any).itemId
await this.post('/finance/links', {
financeId,
entityType,
entityId,
})
})
When('I list finance links for the current finance record', async function (this: PerausetWorld) {
const financeId = (this as any).financeId
await this.get(`/finance/links?financeId=${financeId}`)
})