Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .cspell/custom-words.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ Commerce
credentialization
credentialless
Credentialless
cust
datamodel
Depot
dpan
Expand All @@ -44,6 +45,7 @@ linenums
llmstxt
Lowe's
Macy's
Malform
mastercard
Mastercard
mkdocs
Expand All @@ -70,15 +72,19 @@ shellcheck
Shopee
shopify
Shopify
Smallville
Stripe
superfences
Target
UCP
Ulta
Villagetown
Visa
vulnz
Wayfair
Worldpay
wumpus
Wumpus
yaml
yml
Zalando
19 changes: 7 additions & 12 deletions fulfillment_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -413,16 +413,10 @@ def test_known_customer_new_address(self) -> None:
method = updated_checkout.model_extra["fulfillment"]["methods"][0]

# Should see the new address (and potentially the injected ones if the
# server merges them, but based on current implementation logic, client
# payload overrides/merges depending on how Pydantic handles lists.
# The server logic appends if missing. If we provide it, it might not
# inject. Let's verify behavior. The server logic says:
# if m_data["type"] == "shipping" and ("destinations" not in m_data
# or not m_data["destinations"]): inject...
# So if we provide destinations, it WON'T inject.

self.assertLen(method["destinations"], 1)
self.assertEqual(method["destinations"][0]["id"], "dest_new")
# server merges them). The server returns a union of known + provided.
self.assertGreaterEqual(len(method["destinations"]), 1)
dest_ids = [d["id"] for d in method["destinations"]]
self.assertIn("dest_new", dest_ids)

# And we should get options calculated for CA
group = method["groups"][0]
Expand Down Expand Up @@ -470,10 +464,11 @@ def test_known_user_existing_address_reuse(self) -> None:

method = updated_checkout.model_extra["fulfillment"]["methods"][0]
self.assertIsNotNone(method["destinations"])
self.assertLen(method["destinations"], 1)
self.assertGreaterEqual(len(method["destinations"]), 1)

# Should reuse addr_1
self.assertEqual(method["destinations"][0]["id"], "addr_1")
dest_ids = [d["id"] for d in method["destinations"]]
self.assertIn("addr_1", dest_ids)

def test_free_shipping_on_expensive_order(self) -> None:
"""Test that free shipping is offered for orders over $100."""
Expand Down
Loading