diff --git a/.cspell/custom-words.txt b/.cspell/custom-words.txt index 2d9e222..93b9c3e 100644 --- a/.cspell/custom-words.txt +++ b/.cspell/custom-words.txt @@ -1,13 +1,19 @@ -# cspell-specific custom words related to UCP +absl +absltest +adyen Adyen +agentic Alam Amex Ant Anytown +atok +backorder Backordered Braintree Carrefour Centricity +checkout Chewy Commerce Credentialless @@ -47,37 +53,73 @@ backorder checkout credentialless credentialization +credentialless +Credentialless +# cspell-specific custom words related to UCP +cust datamodel +Depot dpan +Etsy ewallet +EWALLET +Flipkart fontawesome fpan fulfillable +Gap +GitHub +Google gpay +Gpay healthz ingestions inlinehilite +Kroger linenums llmstxt +Lowe's +Macy's +Malform mastercard +Mastercard mkdocs mtok openapi openrpc +Paymentech paypal +Paypal permissionless preorders +Preorders proto protobuf pymdownx +Queensway renderable repudiable schemas sdjwt +Sephora +Shopee shellcheck codespell shopify +Shopify +Smallville +Stripe superfences +Target +UCP +Ulta +Villagetown +Visa vulnz +Wayfair +Worldpay +wumpus +Wumpus yaml yml +Zalando diff --git a/fulfillment_test.py b/fulfillment_test.py index 9557acd..90c574f 100644 --- a/fulfillment_test.py +++ b/fulfillment_test.py @@ -335,16 +335,10 @@ def test_known_customer_new_address(self) -> None: method = updated_checkout.fulfillment.root.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].root.id, "dest_new") + # server merges them). The server returns a union of known + provided. + self.assertGreaterEqual(len(method.destinations), 1) + dest_ids = [d.root.id for d in method.destinations] + self.assertIn("dest_new", dest_ids) # And we should get options calculated for CA group = method.groups[0] @@ -453,10 +447,11 @@ def test_known_user_existing_address_reuse(self) -> None: method = updated_checkout.fulfillment.root.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].root.id, "addr_1") + dest_ids = [d.root.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."""