From 24175025d1bf294bb53ad3f662629f39128c93f5 Mon Sep 17 00:00:00 2001 From: Philip Korsholm <88927411+pKorsholm@users.noreply.github.com> Date: Wed, 2 Feb 2022 08:35:16 +0100 Subject: [PATCH] Fix: admin list products expand integration test (#974) --- .../api/__tests__/admin/product.js | 39 +++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/integration-tests/api/__tests__/admin/product.js b/integration-tests/api/__tests__/admin/product.js index 0816d9e4b0..3a9a83d68f 100644 --- a/integration-tests/api/__tests__/admin/product.js +++ b/integration-tests/api/__tests__/admin/product.js @@ -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()