u
This commit is contained in:
@@ -64,7 +64,6 @@ FROM categoryarticle ca
|
||||
INNER JOIN article a ON a.id = ca.article_id
|
||||
${ARTICLE_LIST_JOINS}
|
||||
WHERE ca.category_id = @categoryId
|
||||
AND a.parentarticle_id IS NULL
|
||||
ORDER BY a.id
|
||||
`;
|
||||
|
||||
@@ -80,7 +79,6 @@ INNER JOIN warehouse w ON w.id = aws.warehouse_id
|
||||
INNER JOIN categoryarticle ca ON ca.article_id = aws.article_id
|
||||
INNER JOIN article a ON a.id = ca.article_id
|
||||
WHERE ca.category_id = @categoryId
|
||||
AND a.parentarticle_id IS NULL
|
||||
ORDER BY w.sort ASC, w.name ASC, aws.id ASC
|
||||
`;
|
||||
|
||||
|
||||
@@ -86,7 +86,6 @@ FROM categoryarticle ca
|
||||
INNER JOIN article a ON a.id = ca.article_id
|
||||
${ARTICLE_LIST_JOINS}
|
||||
WHERE ca.category_id = @categoryId
|
||||
AND a.parentarticle_id IS NULL
|
||||
ORDER BY a.id
|
||||
`;
|
||||
|
||||
|
||||
@@ -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