Sfoglia il codice sorgente

test(core): Fix tests

Michael Bromley 2 anni fa
parent
commit
62d1c3b58e

+ 2 - 0
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',

+ 18 - 6
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',