groceries: Action importer (allowed category listings: price, unit price, EAN from image name; food/drinks, personal care, pets, household consumables) + store row
Deploy production / deploy (push) Successful in 1m13s
Deploy production / deploy (push) Successful in 1m13s
This commit is contained in:
1 parent
0e98acd0a8
commit
1cfbe6486a
5 files changed
+30295
-1
No files matched your search
@@ -1,3 +1,4 @@
|
||||
import { parseActionListing } from './action';
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import { dirkItem } from './dirk';
|
||||
import { hoogvlietCategory, hoogvlietItem } from './hoogvliet';
|
||||
@@ -66,3 +67,25 @@ describe('hoogvliet', () => {
|
||||
).toBeNull();
|
||||
});
|
||||
});
|
||||
|
||||
describe('action', () => {
|
||||
const card = `<div data-testid="product-card" data-content-king="product-card"><a class="g" href="/nl-nl/p/3223916/natural-happiness-pittenmix/" data-testid="product-card-link"><span><img data-testid="product-card-image" alt="" srcSet="x 128w" src="https://asset.action.com/image/upload/t_digital_product_image/w_1920/3223916_8711299010862-111_01_h7ywzh.webp"/></span><span><span data-testid="product-card-title">Natural Happiness pittenmix & zo</span><span class="x" data-testid="product-card-description">300 gram</span></span><span aria-label="€\u00a01,99 €\u00a06,63/kg" class="flex"><span data-testid="product-card-price-description" class="m">€\u00a06,63/kg</span></span></a></div>`;
|
||||
it('parses a listing card', () => {
|
||||
const [it] = parseActionListing(
|
||||
card + card,
|
||||
{ category: 'Snoep, koek & chips', isFood: true },
|
||||
'eten--drinken/noten--snacks'
|
||||
);
|
||||
expect(it).toMatchObject({
|
||||
storeProductId: '3223916',
|
||||
name: 'Natural Happiness pittenmix & zo',
|
||||
sizeText: '300 gram',
|
||||
priceCents: 199,
|
||||
storeUnitPrice: { cents: 663, unit: 'kg' },
|
||||
gtin: '8711299010862',
|
||||
url: 'https://www.action.com/nl-nl/p/3223916/natural-happiness-pittenmix/',
|
||||
categoryPath: 'eten & drinken > noten & snacks',
|
||||
isFood: true
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user