Founder test on a real company (2026-09-05): a supplier created from "Webhallen Oktober · Dataskärmar till kontoret" kept that text as its name, and the SCB facts fetched for the party were nowhere on the supplier page. - Företagsuppgifter on /suppliers/[id] and /customers/[id]: legal name, org number, VAT number, country, then the SCB facts under one source line, with "Hämta uppgifter" or "Hitta i företagsregistret" as the one action. The registry helpers move out of the dossier into RegistryFacts so the three surfaces share them. - The enrich route makes the registry's legal name the displayed name of the party and of supplier and customer rows that still carry the party's old name; all-capitals names are set in title case (lib/parties/registry-name.ts). Names a person set stay. - legacyLedgerKey: a party confirmed under the pre-2026-09-04 key keeps its vouchers, so a rebuild attaches the new key instead of offering the same company again. - GET /api/parties/[id] reports whether SCB is configured. Co-authored-by: Jakob Wennberg <311770904+jakobwennberg-oss@users.noreply.github.com> Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
29 lines
1.5 KiB
TypeScript
29 lines
1.5 KiB
TypeScript
import { describe, it, expect } from 'vitest'
|
|
import { displayNameFromRegistry, sameName } from '../registry-name'
|
|
|
|
describe('displayNameFromRegistry', () => {
|
|
it('sets an all-capitals registry name in title case and keeps legal forms and acronyms', () => {
|
|
expect(displayNameFromRegistry('WEBHALLEN SVERIGE AB')).toBe('Webhallen Sverige AB')
|
|
expect(displayNameFromRegistry('AKTIEBOLAGET VOLVO')).toBe('Aktiebolaget Volvo')
|
|
expect(displayNameFromRegistry('THE INTELLIGENCE COMPANY AB (PUBL)')).toBe('The Intelligence Company AB (publ)')
|
|
expect(displayNameFromRegistry('SEB KORT BANK AB')).toBe('SEB Kort Bank AB')
|
|
expect(displayNameFromRegistry('SVENSK-DANSKA BYGG HB')).toBe('Svensk-Danska Bygg HB')
|
|
expect(displayNameFromRegistry('FÖRENINGEN FÖR SVENSK MUSIK')).toBe('Föreningen för Svensk Musik')
|
|
})
|
|
|
|
it('leaves a name with lowercase letters exactly as written', () => {
|
|
expect(displayNameFromRegistry('The Intelligence Company AB (publ)')).toBe('The Intelligence Company AB (publ)')
|
|
expect(displayNameFromRegistry('Visma Spcs AB')).toBe('Visma Spcs AB')
|
|
expect(displayNameFromRegistry(' Framer B.V. ')).toBe('Framer B.V.')
|
|
})
|
|
})
|
|
|
|
describe('sameName', () => {
|
|
it('compares names case- and whitespace-insensitively and never matches empties', () => {
|
|
expect(sameName('Visma Spcs AB', 'VISMA SPCS AB')).toBe(true)
|
|
expect(sameName('Webhallen Oktober', 'WEBHALLEN SVERIGE AB')).toBe(false)
|
|
expect(sameName('', '')).toBe(false)
|
|
expect(sameName(null, null)).toBe(false)
|
|
})
|
|
})
|