Fix: admin list products expand integration test (#974)

This commit is contained in:
Philip Korsholm
2022-02-02 08:35:16 +01:00
committed by GitHub
parent 7fcdac51ea
commit 24175025d1
@@ -178,6 +178,45 @@ describe("/admin/products", () => {
}
})
it("doesn't expand collection and types", async () => {
const api = useApi()
const notExpected = [
expect.objectContaining({
collection: expect.any(Object),
type: expect.any(Object),
}),
]
const response = await api
.get("/admin/products?status[]=published,proposed&expand=tags", {
headers: {
Authorization: "Bearer test_token",
},
})
.catch((err) => {
console.log(err)
})
expect(response.status).toEqual(200)
expect(response.data.products).toEqual([
expect.objectContaining({
id: "test-product_filtering_1",
status: "proposed",
}),
expect.objectContaining({
id: "test-product_filtering_2",
status: "published",
}),
])
for (const notExpect of notExpected) {
expect(response.data.products).toEqual(
expect.not.arrayContaining([notExpect])
)
}
})
it("returns a list of deleted products with free text query", async () => {
const api = useApi()