fix: correct ID used for refetching after updating customer (#10231)
What correct ID used for refetching after updating customer
This commit is contained in:
2 files changed
+35
-1
No files matched your search
@@ -6,6 +6,7 @@ import {
|
|||||||
generatePublishableKey,
|
generatePublishableKey,
|
||||||
generateStoreHeaders,
|
generateStoreHeaders,
|
||||||
} from "../../../../helpers/create-admin-user"
|
} from "../../../../helpers/create-admin-user"
|
||||||
|
import { createAuthenticatedCustomer } from "../../../../modules/helpers/create-authenticated-customer"
|
||||||
|
|
||||||
jest.setTimeout(50000)
|
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(
|
const customer = await refetchCustomer(
|
||||||
req.params.id,
|
customerId,
|
||||||
req.scope,
|
req.scope,
|
||||||
req.remoteQueryConfig.fields
|
req.remoteQueryConfig.fields
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in new issue
Block a user