fix: correct ID used for refetching after updating customer (#10231)
What correct ID used for refetching after updating customer
This commit is contained in:
@@ -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",
|
||||
}),
|
||||
})
|
||||
})
|
||||
})
|
||||
},
|
||||
})
|
||||
|
||||
@@ -46,7 +46,7 @@ export const POST = async (
|
||||
})
|
||||
|
||||
const customer = await refetchCustomer(
|
||||
req.params.id,
|
||||
customerId,
|
||||
req.scope,
|
||||
req.remoteQueryConfig.fields
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user