This commit is contained in:
seb
2026-10-30 06:43:49 +01:00
parent 64050dffaf
commit 0fdffb864f
3 changed files with 16 additions and 3 deletions

View File

@@ -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),