fix: integration test case

This commit is contained in:
fPolic
2022-02-25 18:53:49 +01:00
committed by olivermrbl
parent 6df5d9b0c6
commit 93d8e8036e
@@ -105,7 +105,7 @@ describe("/admin/customer-groups", () => {
it("gets customer group", async () => { it("gets customer group", async () => {
const api = useApi() const api = useApi()
const id = "test-group-4" const id = "customer-group-1"
const response = await api.get(`/admin/customer-groups/${id}`, { const response = await api.get(`/admin/customer-groups/${id}`, {
headers: { headers: {
@@ -116,30 +116,32 @@ describe("/admin/customer-groups", () => {
expect(response.status).toEqual(200) expect(response.status).toEqual(200)
expect(response.data.customerGroup).toEqual( expect(response.data.customerGroup).toEqual(
expect.objectContaining({ expect.objectContaining({
id: "test-group-4", id: "customer-group-1",
name: "test-group", name: "vip-customers",
}) })
) )
}) })
it("throws error when a customer group doesn't exist", async () => { it("throws error when a customer group doesn't exist", async () => {
expect.assertions(3) expect.assertions(3)
const api = useApi() const api = useApi()
const id = 'test-group-000' const id = "test-group-000"
await api.get(`/admin/customer-groups/${id}`, {
headers: {
Authorization: "Bearer test_token",
},
}).catch(err => {
expect(err.response.status).toEqual(404)
expect(err.response.data.type).toEqual("not_found")
expect(err.response.data.message).toEqual(`CustomerGroup with ${id} was not found`)
})
await api
.get(`/admin/customer-groups/${id}`, {
headers: {
Authorization: "Bearer test_token",
},
})
.catch((err) => {
expect(err.response.status).toEqual(404)
expect(err.response.data.type).toEqual("not_found")
expect(err.response.data.message).toEqual(
`CustomerGroup with ${id} was not found`
)
})
}) })
}) })
}) })