u
This commit is contained in:
@@ -154,6 +154,37 @@ async function runTests() {
|
||||
parentId: cat.id,
|
||||
name: 'Test Article',
|
||||
});
|
||||
assert.equal(article.track_stock, true, 'Default track_stock must be true');
|
||||
|
||||
const fetchedArt = await store.article.getBySku(googleAuthId, article.sku);
|
||||
assert.equal(fetchedArt.article.track_stock, true, 'getBySku must return track_stock: true');
|
||||
|
||||
await store.article.setTrackStockBySku(googleAuthId, article.sku, false);
|
||||
const afterSet = await store.article.getBySku(googleAuthId, article.sku);
|
||||
assert.equal(afterSet.article.track_stock, false, 'setTrackStockBySku false must update track_stock');
|
||||
|
||||
await store.article.updateBySku(googleAuthId, article.sku, { track_stock: true });
|
||||
const afterUpdate = await store.article.getBySku(googleAuthId, article.sku);
|
||||
assert.equal(afterUpdate.article.track_stock, true, 'updateBySku track_stock: true must update track_stock');
|
||||
|
||||
const history = await store.article.getHistoryBySku(googleAuthId, article.sku);
|
||||
assert(history.some((h) => h.text.includes('Bestandsführung geändert von "Nein" auf "Ja"')));
|
||||
|
||||
const nonTracked = await store.article.createUnderParent({
|
||||
googleAuthId,
|
||||
parentId: cat.id,
|
||||
name: 'Service Item',
|
||||
track_stock: false,
|
||||
});
|
||||
assert.equal(nonTracked.track_stock, false, 'Explicit track_stock: false must be preserved');
|
||||
const fetchedNonTracked = await store.article.getBySku(googleAuthId, nonTracked.sku);
|
||||
assert.equal(fetchedNonTracked.article.track_stock, false);
|
||||
|
||||
const exported = await store.article.listExport(googleAuthId, cat.id);
|
||||
const foundExport = exported.find((a) => a.sku === article.sku);
|
||||
assert.equal(foundExport.track_stock, true, 'listExport must include track_stock');
|
||||
|
||||
console.log('Article track_stock tests passed!');
|
||||
|
||||
const sampleImage = await sharp({
|
||||
create: {
|
||||
|
||||
Reference in New Issue
Block a user