From 62d1c3b58e8619363ad9c76de69f7b2e035a5eb7 Mon Sep 17 00:00:00 2001 From: Michael Bromley Date: Tue, 4 Jul 2023 12:16:09 +0200 Subject: [PATCH] test(core): Fix tests --- packages/core/e2e/channel.e2e-spec.ts | 2 ++ packages/core/e2e/product.e2e-spec.ts | 24 ++++++++++++++++++------ 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/packages/core/e2e/channel.e2e-spec.ts b/packages/core/e2e/channel.e2e-spec.ts index 4409093306..30a7a1a0bc 100644 --- a/packages/core/e2e/channel.e2e-spec.ts +++ b/packages/core/e2e/channel.e2e-spec.ts @@ -110,7 +110,9 @@ describe('Channels', () => { id: 'T_2', code: 'second-channel', token: SECOND_CHANNEL_TOKEN, + availableCurrencyCodes: ['GBP'], currencyCode: 'GBP', + defaultCurrencyCode: 'GBP', defaultLanguageCode: 'en', defaultShippingZone: { id: 'T_1', diff --git a/packages/core/e2e/product.e2e-spec.ts b/packages/core/e2e/product.e2e-spec.ts index 24bf6e0a15..18ccf088d1 100644 --- a/packages/core/e2e/product.e2e-spec.ts +++ b/packages/core/e2e/product.e2e-spec.ts @@ -664,7 +664,9 @@ describe('Product resolver', () => { }, }); - expect(productVariants.items).toEqual([ + expect( + productVariants.items.map(i => pick(i, ['id', 'name', 'price', 'priceWithTax', 'sku'])), + ).toEqual([ { id: 'T_34', name: 'Bonsai Tree', @@ -702,7 +704,9 @@ describe('Product resolver', () => { }, }); - expect(productVariants.items).toEqual([ + expect( + productVariants.items.map(i => pick(i, ['id', 'name', 'price', 'priceWithTax', 'sku'])), + ).toEqual([ { id: 'T_23', name: 'Skipping Rope', @@ -740,7 +744,9 @@ describe('Product resolver', () => { }, }); - expect(productVariants.items).toEqual([ + expect( + productVariants.items.map(i => pick(i, ['id', 'name', 'price', 'priceWithTax', 'sku'])), + ).toEqual([ { id: 'T_23', name: 'Skipping Rope', @@ -783,7 +789,9 @@ describe('Product resolver', () => { }, }); - expect(productVariants.items).toEqual([ + expect( + productVariants.items.map(i => pick(i, ['id', 'name', 'price', 'priceWithTax', 'sku'])), + ).toEqual([ { id: 'T_20', name: 'Tripod', @@ -814,7 +822,9 @@ describe('Product resolver', () => { // Note the results are incorrect. This is a design trade-off. See the // commend on the ProductVariant.priceWithTax annotation for explanation. - expect(productVariants.items).toEqual([ + expect( + productVariants.items.map(i => pick(i, ['id', 'name', 'price', 'priceWithTax', 'sku'])), + ).toEqual([ { id: 'T_20', name: 'Tripod', @@ -839,7 +849,9 @@ describe('Product resolver', () => { productId: 'T_1', }); - expect(productVariants.items).toEqual([ + expect( + productVariants.items.map(i => pick(i, ['id', 'name', 'price', 'priceWithTax', 'sku'])), + ).toEqual([ { id: 'T_1', name: 'Laptop 13 inch 8GB',