fix(order): update order summary when transactions change (#8633)

This commit is contained in:
Carlos R. L. Rodrigues
2024-08-16 16:40:44 -03:00
committed by GitHub
parent 0f240137e9
commit be942ff15c
3 changed files with 29 additions and 67 deletions

View File

@@ -40,8 +40,7 @@ medusaIntegrationTestRunner({
describe("GET /admin/users", () => {
it("should list users", async () => {
const response = await api
.get("/admin/users", adminHeaders)
const response = await api.get("/admin/users", adminHeaders)
expect(response.status).toEqual(200)
@@ -91,71 +90,6 @@ medusaIntegrationTestRunner({
})
).data.token
})
// BREAKING: V2 users do not require a role
// We should probably remove this endpoint?
it("should create a user", async () => {
const payload = {
email: "test@test123.com",
}
// In V2, the flow to create an authenticated user depends on the token or session of a previously created auth user
const headers = {
headers: { Authorization: `Bearer ${token}` },
}
const response = await api.post("/admin/users", payload, headers)
expect(response.status).toEqual(200)
expect(response.data.user).toEqual(
expect.objectContaining({
id: expect.stringMatching(/^user_*/),
created_at: expect.any(String),
updated_at: expect.any(String),
email: "test@test123.com",
})
)
})
// V2 only test
it("should throw, if session/bearer auth is present for existing user", async () => {
const emailPassResponse = await api.post("/auth/user/emailpass", {
email: "test@test123.com",
password: "test123",
})
const token = emailPassResponse.data.token
const headers = (token) => ({
headers: { Authorization: `Bearer ${token}` },
})
const res = await api.post(
"/admin/users",
{
email: "test@test123.com",
},
headers(token)
)
const authenticated = await api.post("/auth/user/emailpass", {
email: "test@test123.com",
password: "test123",
})
const payload = {
email: "different@email.com",
}
const errorResponse = await api
.post("/admin/users", payload, headers(authenticated.data.token))
.catch((err) => err.response)
expect(errorResponse.status).toEqual(400)
expect(errorResponse.data.message).toEqual(
"Request carries authentication for an existing user"
)
})
})
describe("POST /admin/users/:id", () => {