← back to Dw Checkout Guard
checkout-guard: replace stale scaffold fixtures with real DW behaviour tests
667cf8e45102de22b639033f3db88d923039ae50 · 2026-09-11 12:04:41 -0700 · Steve Abrams
The repo shipped Shopify's default cart-validation scaffold fixtures
(quantity-is-one / quantity-exceeds-one). They carry only a quantity
field, so they do not satisfy this function's input query (which reads
cost.amountPerQuantity and merchandise.product.isDiscontinued) and
validateTestAssets failed 2/2 — i.e. the guard shipped with a test suite
that had never once exercised the guard.
Replaced with five fixtures run against the real compiled function.wasm:
dw-zero-price-BLOCKS $0.00 Per Yard -> blocked
dw-sample-only-ALLOWS $4.25 Sample -> ALLOWED
dw-mixed-zero-plus-sample-BLOCKS $0 + $4.25 -> blocked
dw-discontinued-BLOCKS discontinued tag -> blocked
dw-zero-plus-discontinued-MIXED both -> mixed message
The allow case is the load-bearing one: this cohort must keep its $4.25
sample flow working, so a guard that blocked everything would be worse
than no guard. 5/5 pass.
TK-11301. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XA7ZPurwcdipst1gsgwwXq
Files touched
A extensions/dw-checkout-guard/tests/fixtures/dw-discontinued-BLOCKS.jsonA extensions/dw-checkout-guard/tests/fixtures/dw-mixed-zero-plus-sample-BLOCKS.jsonA extensions/dw-checkout-guard/tests/fixtures/dw-sample-only-ALLOWS.jsonA extensions/dw-checkout-guard/tests/fixtures/dw-zero-plus-discontinued-MIXED.jsonA extensions/dw-checkout-guard/tests/fixtures/dw-zero-price-BLOCKS.jsonD extensions/dw-checkout-guard/tests/fixtures/quantity-exceeds-one.jsonD extensions/dw-checkout-guard/tests/fixtures/quantity-is-one.json
Diff
commit 667cf8e45102de22b639033f3db88d923039ae50
Author: Steve Abrams <steve@designerwallcoverings.com>
Date: Fri Sep 11 12:04:41 2026 -0700
checkout-guard: replace stale scaffold fixtures with real DW behaviour tests
The repo shipped Shopify's default cart-validation scaffold fixtures
(quantity-is-one / quantity-exceeds-one). They carry only a quantity
field, so they do not satisfy this function's input query (which reads
cost.amountPerQuantity and merchandise.product.isDiscontinued) and
validateTestAssets failed 2/2 — i.e. the guard shipped with a test suite
that had never once exercised the guard.
Replaced with five fixtures run against the real compiled function.wasm:
dw-zero-price-BLOCKS $0.00 Per Yard -> blocked
dw-sample-only-ALLOWS $4.25 Sample -> ALLOWED
dw-mixed-zero-plus-sample-BLOCKS $0 + $4.25 -> blocked
dw-discontinued-BLOCKS discontinued tag -> blocked
dw-zero-plus-discontinued-MIXED both -> mixed message
The allow case is the load-bearing one: this cohort must keep its $4.25
sample flow working, so a guard that blocked everything would be worse
than no guard. 5/5 pass.
TK-11301. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XA7ZPurwcdipst1gsgwwXq
---
.../tests/fixtures/dw-discontinued-BLOCKS.json | 1 +
.../fixtures/dw-mixed-zero-plus-sample-BLOCKS.json | 1 +
.../tests/fixtures/dw-sample-only-ALLOWS.json | 1 +
.../fixtures/dw-zero-plus-discontinued-MIXED.json | 1 +
.../tests/fixtures/dw-zero-price-BLOCKS.json | 1 +
.../tests/fixtures/quantity-exceeds-one.json | 29 ---------------------
.../tests/fixtures/quantity-is-one.json | 30 ----------------------
7 files changed, 5 insertions(+), 59 deletions(-)
diff --git a/extensions/dw-checkout-guard/tests/fixtures/dw-discontinued-BLOCKS.json b/extensions/dw-checkout-guard/tests/fixtures/dw-discontinued-BLOCKS.json
new file mode 100644
index 0000000..1590100
--- /dev/null
+++ b/extensions/dw-checkout-guard/tests/fixtures/dw-discontinued-BLOCKS.json
@@ -0,0 +1 @@
+{"payload":{"export":"cart-validations-generate-run","target":"cart.validations.generate.run","input":{"cart":{"lines":[{"quantity":1,"cost":{"amountPerQuantity":{"amount":"65.00"}},"merchandise":{"__typename":"ProductVariant","id":"gid://shopify/ProductVariant/44585603072099","title":"Per Yard","product":{"id":"gid://shopify/Product/7896457248819","title":"Vienna Pick Up Sticks Wild Card","isDiscontinued":true}}}]}},"output":{"operations":[{"validationAdd":{"errors":[{"message":"Your cart contains a discontinued item that can no longer be ordered — please remove it to continue to checkout.","target":"$.cart"}]}}]}}}
diff --git a/extensions/dw-checkout-guard/tests/fixtures/dw-mixed-zero-plus-sample-BLOCKS.json b/extensions/dw-checkout-guard/tests/fixtures/dw-mixed-zero-plus-sample-BLOCKS.json
new file mode 100644
index 0000000..1b4870b
--- /dev/null
+++ b/extensions/dw-checkout-guard/tests/fixtures/dw-mixed-zero-plus-sample-BLOCKS.json
@@ -0,0 +1 @@
+{"payload":{"export":"cart-validations-generate-run","target":"cart.validations.generate.run","input":{"cart":{"lines":[{"quantity":1,"cost":{"amountPerQuantity":{"amount":"0.00"}},"merchandise":{"__typename":"ProductVariant","id":"gid://shopify/ProductVariant/44585603072051","title":"Per Yard","product":{"id":"gid://shopify/Product/7896457248819","title":"Vienna Pick Up Sticks Wild Card","isDiscontinued":false}}},{"quantity":1,"cost":{"amountPerQuantity":{"amount":"4.25"}},"merchandise":{"__typename":"ProductVariant","id":"gid://shopify/ProductVariant/44792625659955","title":"Sample","product":{"id":"gid://shopify/Product/7896457248819","title":"Vienna Pick Up Sticks Wild Card","isDiscontinued":false}}}]}},"output":{"operations":[{"validationAdd":{"errors":[{"message":"Your cart contains an item that can't be purchased online — please request a quote or remove it to continue to checkout.","target":"$.cart"}]}}]}}}
diff --git a/extensions/dw-checkout-guard/tests/fixtures/dw-sample-only-ALLOWS.json b/extensions/dw-checkout-guard/tests/fixtures/dw-sample-only-ALLOWS.json
new file mode 100644
index 0000000..22b4966
--- /dev/null
+++ b/extensions/dw-checkout-guard/tests/fixtures/dw-sample-only-ALLOWS.json
@@ -0,0 +1 @@
+{"payload":{"export":"cart-validations-generate-run","target":"cart.validations.generate.run","input":{"cart":{"lines":[{"quantity":1,"cost":{"amountPerQuantity":{"amount":"4.25"}},"merchandise":{"__typename":"ProductVariant","id":"gid://shopify/ProductVariant/44792625659955","title":"Sample","product":{"id":"gid://shopify/Product/7896457248819","title":"Vienna Pick Up Sticks Wild Card","isDiscontinued":false}}}]}},"output":{"operations":[]}}}
diff --git a/extensions/dw-checkout-guard/tests/fixtures/dw-zero-plus-discontinued-MIXED.json b/extensions/dw-checkout-guard/tests/fixtures/dw-zero-plus-discontinued-MIXED.json
new file mode 100644
index 0000000..69f39e8
--- /dev/null
+++ b/extensions/dw-checkout-guard/tests/fixtures/dw-zero-plus-discontinued-MIXED.json
@@ -0,0 +1 @@
+{"payload":{"export":"cart-validations-generate-run","target":"cart.validations.generate.run","input":{"cart":{"lines":[{"quantity":1,"cost":{"amountPerQuantity":{"amount":"0.00"}},"merchandise":{"__typename":"ProductVariant","id":"gid://shopify/ProductVariant/44585603072051","title":"Per Yard","product":{"id":"gid://shopify/Product/7896457248819","title":"Vienna Pick Up Sticks Wild Card","isDiscontinued":false}}},{"quantity":1,"cost":{"amountPerQuantity":{"amount":"65.00"}},"merchandise":{"__typename":"ProductVariant","id":"gid://shopify/ProductVariant/44585603072099","title":"Per Yard","product":{"id":"gid://shopify/Product/7896457248819","title":"Vienna Pick Up Sticks Wild Card","isDiscontinued":true}}}]}},"output":{"operations":[{"validationAdd":{"errors":[{"message":"Your cart contains items that can't be ordered online (discontinued or quote-only) — please remove them to continue to checkout.","target":"$.cart"}]}}]}}}
diff --git a/extensions/dw-checkout-guard/tests/fixtures/dw-zero-price-BLOCKS.json b/extensions/dw-checkout-guard/tests/fixtures/dw-zero-price-BLOCKS.json
new file mode 100644
index 0000000..21db560
--- /dev/null
+++ b/extensions/dw-checkout-guard/tests/fixtures/dw-zero-price-BLOCKS.json
@@ -0,0 +1 @@
+{"payload":{"export":"cart-validations-generate-run","target":"cart.validations.generate.run","input":{"cart":{"lines":[{"quantity":1,"cost":{"amountPerQuantity":{"amount":"0.00"}},"merchandise":{"__typename":"ProductVariant","id":"gid://shopify/ProductVariant/44585603072051","title":"Per Yard","product":{"id":"gid://shopify/Product/7896457248819","title":"Vienna Pick Up Sticks Wild Card","isDiscontinued":false}}}]}},"output":{"operations":[{"validationAdd":{"errors":[{"message":"Your cart contains an item that can't be purchased online — please request a quote or remove it to continue to checkout.","target":"$.cart"}]}}]}}}
diff --git a/extensions/dw-checkout-guard/tests/fixtures/quantity-exceeds-one.json b/extensions/dw-checkout-guard/tests/fixtures/quantity-exceeds-one.json
deleted file mode 100644
index 50bc5a0..0000000
--- a/extensions/dw-checkout-guard/tests/fixtures/quantity-exceeds-one.json
+++ /dev/null
@@ -1,29 +0,0 @@
-{
- "payload": {
- "export": "cart-validations-generate-run",
- "target": "cart.validations.generate.run",
- "input": {
- "cart": {
- "lines": [
- {
- "quantity": 3
- }
- ]
- }
- },
- "output": {
- "operations": [
- {
- "validationAdd": {
- "errors": [
- {
- "message": "Not possible to order more than one of each",
- "target": "$.cart"
- }
- ]
- }
- }
- ]
- }
- }
-}
diff --git a/extensions/dw-checkout-guard/tests/fixtures/quantity-is-one.json b/extensions/dw-checkout-guard/tests/fixtures/quantity-is-one.json
deleted file mode 100644
index 8519d8c..0000000
--- a/extensions/dw-checkout-guard/tests/fixtures/quantity-is-one.json
+++ /dev/null
@@ -1,30 +0,0 @@
-{
- "payload": {
- "export": "cart-validations-generate-run",
- "target": "cart.validations.generate.run",
- "input": {
- "cart": {
- "lines": [
- {
- "quantity": 1
- },
- {
- "quantity": 1
- },
- {
- "quantity": 1
- }
- ]
- }
- },
- "output": {
- "operations": [
- {
- "validationAdd": {
- "errors": []
- }
- }
- ]
- }
- }
-}
← 20e4143 auto-data-snapshot: 2026-09-04T12:55:58 (1 data files) — RES
·
back to Dw Checkout Guard
·
chore: v1.0.1 (session close) fb043ce →