This commit is contained in:
seb
2026-10-04 18:56:55 +02:00
parent 9a1c19cf60
commit 2158ac475b
4 changed files with 382 additions and 32 deletions

View File

@@ -116,6 +116,36 @@ async function run() {
// Fathersort should have picked 0 (next free non-negative integer)
assert.deepEqual(list.map((c) => c.fathersort), [0, 1]);
console.log('6. Testing rejecting sku when creating via addChild...');
await assert.rejects(
async () => {
await store.article.addChild(googleAuthId, father.sku, {
sku: 'SOME-CUSTOM-SKU',
value: 'Lila',
});
},
(err) => {
assert.match(err.message, /sku is not allowed when creating a child article/);
return true;
},
'Expected sku on addChild to be rejected'
);
console.log('7. Testing attaching existing orphan article (SKU-2) via attachChild...');
const reconnected = await store.article.attachChild(googleAuthId, father.sku, {
sku: child2.article.sku,
value: 'Blau',
});
assert.equal(reconnected.article.sku, child2.article.sku);
assert.equal(reconnected.article.fatherArticleId, father.id);
console.log('8. Testing idempotent attachChild on same father...');
const idempotentResult = await store.article.attachChild(googleAuthId, father.sku, {
sku: child2.article.sku,
value: 'Blau',
});
assert.equal(idempotentResult.article.sku, child2.article.sku);
console.log('✅ ALL VARIANT FLOW TESTS PASSED');
} finally {
try {