Files
accounted/tests/pg/pending-operations-update-invoice.pg.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

38 lines
1.3 KiB
TypeScript

import { beforeAll, describe, it } from 'vitest'
import { getPool } from './setup'
import { seedCompany } from './fixtures'
/**
* The pending_operations_operation_type_check constraint must accept the
* 'update_invoice' op type added by migration 20260727090000 (validated in
* 20260727090001). Without the constraint expansion, gnubok_update_invoice's
* staging INSERT fails with check_violation on every real call while dry_run
* (which skips the INSERT) previews clean: the exact bug class the op-type
* audit test documents for gnubok_link_document_to_voucher.
*/
describe('pending_operations operation_type CHECK: update_invoice', () => {
let userId: string
let companyId: string
beforeAll(async () => {
const seeded = await seedCompany()
userId = seeded.userId
companyId = seeded.companyId
})
it('accepts update_invoice (constraint expanded in 20260727090000)', async () => {
const client = await getPool().connect()
try {
await client.query('BEGIN')
await client.query(
`INSERT INTO public.pending_operations (user_id, company_id, operation_type, title)
VALUES ($1, $2, 'update_invoice', 'regression: uppdatera fakturautkast')`,
[userId, companyId],
)
await client.query('ROLLBACK')
} finally {
client.release()
}
})
})