feat: implement alias strategy for receipt import with user-scoped and global fallback, enhance validation and normalization, and update UI components
Test Suite / test (24.15.0) (push) Has been cancelled

This commit is contained in:
Nils-Johan Gynther
2026-05-09 23:41:42 +02:00
parent b342de906e
commit 65137b41fb
17 changed files with 388 additions and 67 deletions
@@ -165,6 +165,28 @@ describe('ReceiptImportService test matrix', () => {
expect(result.matchedProductName).toBe('Snickers');
});
it('normaliserar whitespace vid alias-lookup', async () => {
const aliases = [
{
receiptName: 'arla mjolk 1l',
productId: 700,
product: {
id: 700,
name: 'Arla Mjolk 1l',
canonicalName: 'Mjolk',
categoryId: 30,
categoryRef: { id: 30, name: 'Mejeri' },
},
},
];
const context = makeContext(aliases, [], [], 42);
const result = await (service as any).matchAndEnrichReceiptItem({ rawName: ' ARLA MJOLK 1L ' }, context);
expect(result.matchedProductId).toBe(700);
expect(result.matchedVia).toBe('alias');
});
it('flöde: manuell korrigering lär alias och nästa import matchar direkt', async () => {
const products = [
{