From 976b57f944ecdabd22ab7b93618322ee7585ccd9 Mon Sep 17 00:00:00 2001 From: pKorsholm Date: Wed, 8 Sep 2021 15:19:46 +0200 Subject: [PATCH] adjusted product tests after removing sorting and public variant ranks --- .../medusa/src/services/__tests__/product.js | 34 ++----------------- 1 file changed, 3 insertions(+), 31 deletions(-) diff --git a/packages/medusa/src/services/__tests__/product.js b/packages/medusa/src/services/__tests__/product.js index 2cc3a90918..4f4033d7a3 100644 --- a/packages/medusa/src/services/__tests__/product.js +++ b/packages/medusa/src/services/__tests__/product.js @@ -16,14 +16,14 @@ describe("ProductService", () => { return { id: "test id with variants", variants: [ - { id: "test_321", title: "Green", variant_rank: 1 }, - { id: "test_123", title: "Blue", variant_rank: 0 }, + { id: "test_321", title: "Green" }, + { id: "test_123", title: "Blue" }, ], } if (query.where.id === "test id one variant") return { id: "test id one variant", - variants: [{ id: "test_123", title: "Blue", variant_rank: 0 }], + variants: [{ id: "test_123", title: "Blue" }], } return Promise.resolve({ id: IdMap.getId("ironman") }) }, @@ -38,30 +38,6 @@ describe("ProductService", () => { jest.clearAllMocks() }) - it("Orders variants according to rank when retrieving a product", async () => { - const result = await productService.retrieve("test id with variants", { - relations: ["Variants"], - }) - - expect(productRepo.findOneWithRelations).toHaveBeenCalledTimes(1) - expect(productRepo.findOneWithRelations).toHaveBeenCalledWith( - ["Variants"], - { - where: { id: "test id with variants" }, - } - ) - - const expected = { - id: "test id with variants", - variants: [ - { id: "test_123", title: "Blue", variant_rank: 0 }, - { id: "test_321", title: "Green", variant_rank: 1 }, - ], - } - - expect(result).toEqual(expected) - }) - it("successfully retrieves a product", async () => { const result = await productService.retrieve(IdMap.getId("ironman")) @@ -162,12 +138,10 @@ describe("ProductService", () => { { id: "test1", title: "green", - variant_rank: 0, }, { id: "test2", title: "blue", - variant_rank: 1, }, ], }) @@ -204,12 +178,10 @@ describe("ProductService", () => { { id: "test1", title: "green", - variant_rank: 0, }, { id: "test2", title: "blue", - variant_rank: 1, }, ], })