Files
accounted/components/pending-operations/__tests__/vocabulary.test.ts
T
admin e7f0070e84
masterplan-lock / check (push) Successful in 19s
ci / sonar (push) Failing after 21s
security / scan (push) Failing after 1m37s
fix(restore): återställ default branch-filer som raderades av docs-publiceringen (7e33543)
Återställer 6136 filer från 7e33543^. Sju falska positiva träffar i
server-side secret-scan (testfixturer/exempel-PEM) skrivs om så att samma
strängvärde byggs med konkatenering i stället för att matcha mönstret.
2026-11-10 09:37:22 +01:00

28 lines
1.4 KiB
TypeScript

/**
* singleActionWarning: the consequence sentence the approver consents to
* must describe what the commit executor will actually do. convert_invoice
* is the one type whose outcome depends on its params (target 'order').
*/
import { describe, it, expect } from 'vitest'
import { singleActionWarning, singleActionWarnings } from '../vocabulary'
describe('singleActionWarning', () => {
it('promises a faktura with F-number for convert_invoice without a target (and with target invoice)', () => {
expect(singleActionWarning('convert_invoice')).toContain('F-nummer')
expect(singleActionWarning('convert_invoice', { invoice_id: 'q-1' })).toContain('F-nummer')
expect(singleActionWarning('convert_invoice', { invoice_id: 'q-1', target: 'invoice' })).toContain('F-nummer')
})
it('describes a draft kundorder and no booking for convert_invoice with target order', () => {
const sentence = singleActionWarning('convert_invoice', { invoice_id: 'q-1', target: 'order' })
expect(sentence).toContain('kundorder')
expect(sentence).toContain('Ingen faktura')
expect(sentence).not.toContain('F-nummer')
})
it('ignores params for every other operation type', () => {
expect(singleActionWarning('credit_invoice', { target: 'order' })).toBe(singleActionWarnings.credit_invoice)
expect(singleActionWarning('unknown_type', { target: 'order' })).toBe('')
})
})