fix: correct ID used for refetching after updating customer (#10231)

What
   correct ID used for refetching after updating customer
This commit is contained in:
Dos
2024-11-22 21:58:25 +07:00
committed by GitHub
parent d6ff8d7aa1
commit 97ef3a5337
2 changed files with 35 additions and 1 deletions

View File

@@ -6,6 +6,7 @@ import {
generatePublishableKey,
generateStoreHeaders,
} from "../../../../helpers/create-admin-user"
import { createAuthenticatedCustomer } from "../../../../modules/helpers/create-authenticated-customer"
jest.setTimeout(50000)
@@ -265,5 +266,38 @@ medusaIntegrationTestRunner({
})
})
})
describe("POST /store/customers/me", () => {
it("should successfully update a customer", async () => {
const { customer, jwt } = await createAuthenticatedCustomer(
api,
storeHeaders
)
const response = await api.post(
`/store/customers/me`,
{
first_name: "John2",
last_name: "Doe2",
},
{
headers: {
authorization: `Bearer ${jwt}`,
...storeHeaders.headers,
},
}
)
expect(response.status).toEqual(200)
expect(response.data).toEqual({
customer: expect.objectContaining({
id: customer.id,
first_name: "John2",
last_name: "Doe2",
email: "tony@start.com",
}),
})
})
})
},
})

View File

@@ -46,7 +46,7 @@ export const POST = async (
})
const customer = await refetchCustomer(
req.params.id,
customerId,
req.scope,
req.remoteQueryConfig.fields
)