Å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.
43 lines
1.4 KiB
TypeScript
43 lines
1.4 KiB
TypeScript
import { describe, expect, it } from 'vitest'
|
|
import { mapFortnoxToCustomer } from '../mapper'
|
|
|
|
describe('Fortnox customer metadata mapping', () => {
|
|
it('prefers invoice email and carries reference plus CC/BCC recipients', () => {
|
|
const dto = mapFortnoxToCustomer({
|
|
CustomerNumber: '1001',
|
|
Name: 'Kund AB',
|
|
Email: '[email protected]',
|
|
EmailInvoice: '[email protected]',
|
|
EmailInvoiceCC: '[email protected]; [email protected], [email protected]',
|
|
EmailInvoiceBCC: ['[email protected]', '[email protected]'],
|
|
YourReference: 'Anna Andersson',
|
|
Active: true,
|
|
})
|
|
|
|
expect(dto.party.contact).toMatchObject({
|
|
name: 'Anna Andersson',
|
|
email: '[email protected]',
|
|
})
|
|
expect(dto.invoiceEmailCcAddresses).toEqual([
|
|
'[email protected]',
|
|
'[email protected]',
|
|
])
|
|
expect(dto.invoiceEmailBccAddresses).toEqual([
|
|
'[email protected]',
|
|
'[email protected]',
|
|
])
|
|
})
|
|
|
|
it('falls back to the general email and preserves absent copy fields as undefined', () => {
|
|
const dto = mapFortnoxToCustomer({
|
|
CustomerNumber: '1002',
|
|
Name: 'Kund Två AB',
|
|
Email: '[email protected]',
|
|
})
|
|
|
|
expect(dto.party.contact?.email).toBe('[email protected]')
|
|
expect(dto.invoiceEmailCcAddresses).toBeUndefined()
|
|
expect(dto.invoiceEmailBccAddresses).toBeUndefined()
|
|
})
|
|
})
|