u
This commit is contained in:
@@ -105,6 +105,22 @@ describe('store.category', () => {
|
||||
assert.ok(listWithImg[0].smallThumbBinary.length > 0);
|
||||
});
|
||||
|
||||
it('includes child articles (variants) in the category', async () => {
|
||||
const cat = await create('Variants Cat');
|
||||
const attr = await store.attributename.create(tenant.googleAuthId, { name: 'Größe' });
|
||||
const parent = await createArticle(store, tenant, { parentId: cat.id, name: 'Shirt Parent' });
|
||||
await store.article.toggleParent(tenant.googleAuthId, parent.sku, { isParent: true, attributeNameId: attr.id });
|
||||
const child = await store.article.addChild(tenant.googleAuthId, parent.sku, { value: 'XL' });
|
||||
|
||||
const list = await store.category.getCategoryArticles(tenant.googleAuthId, cat.id);
|
||||
const skus = list.map((a) => a.sku);
|
||||
assert.ok(skus.includes(parent.sku));
|
||||
assert.ok(skus.includes(child.article.sku));
|
||||
const childItem = list.find((a) => a.sku === child.article.sku);
|
||||
assert.equal(childItem.parentArticleId, parent.id);
|
||||
assert.equal(childItem.parentSku, parent.sku);
|
||||
});
|
||||
|
||||
it('rejects a category of another company', async () => {
|
||||
await assert.rejects(
|
||||
() => store.category.getCategoryArticles(tenant.googleAuthId, other.rootCategoryId),
|
||||
|
||||
Reference in New Issue
Block a user