← back to Designer Wallcoverings
worker-guard: harden tests — batched productCreate (input0/input1), inventoryItem.sku, gid-form id, -Roll stripping (13/13 pass)
9979cea077c232ff1b18394641d8c7b383344fe0 · 2026-06-12 09:41:53 -0700 · SteveStudio2
Files touched
M shopify/scripts/worker-guard/test-dedup-guard.js
Diff
commit 9979cea077c232ff1b18394641d8c7b383344fe0
Author: SteveStudio2 <steve@designerwallcoverings.com>
Date: Fri Jun 12 09:41:53 2026 -0700
worker-guard: harden tests — batched productCreate (input0/input1), inventoryItem.sku, gid-form id, -Roll stripping (13/13 pass)
---
shopify/scripts/worker-guard/test-dedup-guard.js | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/shopify/scripts/worker-guard/test-dedup-guard.js b/shopify/scripts/worker-guard/test-dedup-guard.js
index d7abaa62..d393c136 100644
--- a/shopify/scripts/worker-guard/test-dedup-guard.js
+++ b/shopify/scripts/worker-guard/test-dedup-guard.js
@@ -36,6 +36,16 @@ eq('extract: update (has input.id) → null', extractCreateSku(updateJob), null)
eq('extract: metafield op → null', extractCreateSku(metafieldJob), null);
eq('extract: sku-less create → null', extractCreateSku(skulessCreate), null);
+// edge cases — batched productCreate (input0/input1) and inventoryItem.sku shape
+const batchedCreate = { method: 'POST', endpoint: '/graphql.json', payload: { query: 'mutation{ p0: productCreate(input:$input0){product{id}} p1: productCreate(input:$input1){product{id}} }',
+ variables: { input0: { variants: [ { inventoryItem: { sku: 'DWAB-100001' } } ] }, input1: { variants: [ { sku: 'DWAB-100002-Roll' } ] } } } };
+const gidUpdate = { method: 'POST', endpoint: '/graphql.json', payload: { query: 'mutation{ productSet(input:$input){product{id}} }',
+ variables: { input: { id: 'gid://shopify/Product/999', variants: [ { sku: 'DWAB-100003' } ] } } } };
+eq('extract: batched productCreate (input0/input1) → first base', extractCreateSku(batchedCreate)?.base, 'DWAB-100001');
+eq('extract: inventoryItem.sku shape picked up', extractCreateSku(batchedCreate)?.skus.includes('DWAB-100001'), true);
+eq('extract: gid-form input.id → null (update)', extractCreateSku(gidUpdate), null);
+eq('extract: -Roll suffix stripped to base', extractCreateSku({ ...createJob, payload: { ...createJob.payload, variables: { input: { variants: [ { sku: 'DWHD-508056-Roll' } ] } } } })?.base, 'DWHD-508056');
+
// --- 2. live Shopify lookup + full guard (network) ---
(async () => {
if (!TOKEN) { console.error('no token'); process.exit(1); }
← 1f1b3a64 cadence: vendor colOverrides (Newwall length→roll_length, re
·
back to Designer Wallcoverings
·
Add remaining-restore-campaign plan (tiers 1-4: ready/verify 69ccaeba →