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
Test Suite / test (24.15.0) (push) Has been cancelled
This commit is contained in:
@@ -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 = [
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user