Files
accounted/extensions/general/arcim-migration/lib/__tests__/entity-mapper-customer-metadata.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

47 lines
1.4 KiB
TypeScript

import { describe, expect, it } from 'vitest'
import type { CustomerDto } from '@/lib/providers/dto'
import { mapCustomer } from '../entity-mapper'
describe('Arcim customer metadata mapping', () => {
it('maps contact person and customer-specific invoice recipients', () => {
const dto: CustomerDto = {
id: 'customer-1',
customerNumber: '1001',
type: 'company',
party: {
name: 'Kund AB',
identifications: [{ id: '556677-8899', schemeId: 'SE:ORGNR' }],
contact: {
name: 'Anna Andersson',
email: 'invoice@example.test',
},
},
invoiceEmailCcAddresses: ['finance@example.test'],
invoiceEmailBccAddresses: ['archive@example.test'],
active: true,
}
expect(mapCustomer(dto, 'user-1', 'company-1')).toMatchObject({
contact_person: 'Anna Andersson',
email: 'invoice@example.test',
invoice_email_cc_addresses: ['finance@example.test'],
invoice_email_bcc_addresses: ['archive@example.test'],
})
})
it('uses null for provider fields that were not supplied', () => {
const dto: CustomerDto = {
id: 'customer-2',
customerNumber: '1002',
party: { name: 'Kund Två AB', identifications: [] },
active: true,
}
expect(mapCustomer(dto, 'user-1', 'company-1')).toMatchObject({
contact_person: null,
invoice_email_cc_addresses: null,
invoice_email_bcc_addresses: null,
})
})
})