fix(medusa): keep country_code when partially updating cart addresses (#2683)
**What** - Fixes a bug where `country_code` was dropped when partially updating a shipping or billing address on a cart.
This commit is contained in:
committed by
GitHub
parent
d68e81fb3d
commit
33aa3edb80
@@ -1642,6 +1642,44 @@ describe("/store/carts", () => {
|
||||
expect(response.status).toEqual(200)
|
||||
})
|
||||
|
||||
it("partially updates shipping and billing address while retaining the addresses country codes", async () => {
|
||||
const api = useApi()
|
||||
|
||||
// Partially update the shipping address
|
||||
await api
|
||||
.post("/store/carts/test-cart", {
|
||||
shipping_address: {
|
||||
last_name: "james",
|
||||
},
|
||||
})
|
||||
.catch((error) => console.log(error))
|
||||
|
||||
// Partially update the billing address
|
||||
const response = await api.post("/store/carts/test-cart", {
|
||||
billing_address: {
|
||||
first_name: "bruce",
|
||||
last_name: "banner",
|
||||
country_code: "us",
|
||||
},
|
||||
})
|
||||
|
||||
expect(response.status).toEqual(200)
|
||||
expect(response.data.cart).toEqual(
|
||||
expect.objectContaining({
|
||||
shipping_address: expect.objectContaining({
|
||||
first_name: "lebron",
|
||||
last_name: "james",
|
||||
country_code: "us",
|
||||
}),
|
||||
billing_address: expect.objectContaining({
|
||||
first_name: "bruce",
|
||||
last_name: "banner",
|
||||
country_code: "us",
|
||||
}),
|
||||
})
|
||||
)
|
||||
})
|
||||
|
||||
it("adds free shipping to cart then removes it again", async () => {
|
||||
const api = useApi()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user