mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-29 16:28:12 +00:00
fixes
This commit is contained in:
@@ -63,6 +63,21 @@ describe('ETradeService business selection', () => {
|
||||
expect(fetched).toEqual(['MT/AA/14/670/11551235/2017']);
|
||||
});
|
||||
|
||||
it('survives the null entries eTrade puts in SubGroups', () => {
|
||||
const { service } = build();
|
||||
const info = companyInfo();
|
||||
(info.Businesses[0] as any).SubGroups = [
|
||||
null,
|
||||
{ Code: 66331, Description: 'Export trade in minerals' },
|
||||
{ Code: 1, Description: null },
|
||||
];
|
||||
const data = service.extractRegistrationData(
|
||||
{ LicenceNumber: 'x' } as ETradeBusinessInfo,
|
||||
info,
|
||||
);
|
||||
expect(data.businesses?.[0].activity).toBe('Export trade in minerals');
|
||||
});
|
||||
|
||||
it('lists every licence for the picker, code prefixes stripped', () => {
|
||||
const { service } = build();
|
||||
const data = service.extractRegistrationData(
|
||||
|
||||
@@ -142,7 +142,8 @@ export class ETradeService {
|
||||
tradeName: b.TradesName?.trim() || "",
|
||||
activity: (b.SubGroups ?? [])
|
||||
// Some descriptions repeat the code inline ("(65611)Import trade …").
|
||||
.map((g) => g.Description?.replace(/^\(\d+\)\s*/, "").trim())
|
||||
// eTrade also puts null entries in this array, so every hop is optional.
|
||||
.map((g) => g?.Description?.replace(/^\(\d+\)\s*/, "").trim())
|
||||
.filter(Boolean)
|
||||
.join(", "),
|
||||
renewedTo: b.RenewedTo || "",
|
||||
|
||||
Reference in New Issue
Block a user