Browse Source

test(core): Fix failing postgres e2e tests

Michael Bromley 5 years ago
parent
commit
7e98c589b8

+ 8 - 3
packages/core/e2e/entity-id-strategy.e2e-spec.ts

@@ -17,6 +17,7 @@ import {
     IdTest8,
     LanguageCode,
 } from './graphql/generated-e2e-admin-types';
+import { sortById } from './utils/test-order-utils';
 
 describe('EntityIdStrategy', () => {
     const { server, adminClient, shopClient } = createTestEnvironment(testConfig);
@@ -44,9 +45,13 @@ describe('EntityIdStrategy', () => {
                 }
             }
         `);
-        expect(products).toEqual({
-            items: [{ id: 'T_1' }, { id: 'T_2' }, { id: 'T_3' }, { id: 'T_4' }, { id: 'T_5' }],
-        });
+        expect(products.items.sort(sortById)).toEqual([
+            { id: 'T_1' },
+            { id: 'T_2' },
+            { id: 'T_3' },
+            { id: 'T_4' },
+            { id: 'T_5' },
+        ]);
     });
 
     it('Does not doubly-encode ids from resolved properties', async () => {

+ 2 - 1
packages/core/e2e/order-taxes.e2e-spec.ts

@@ -18,6 +18,7 @@ import {
 } from './graphql/generated-e2e-shop-types';
 import { GET_PRODUCTS_WITH_VARIANT_PRICES, UPDATE_CHANNEL } from './graphql/shared-definitions';
 import { ADD_ITEM_TO_ORDER, GET_ACTIVE_ORDER_WITH_PRICE_DATA } from './graphql/shop-definitions';
+import { sortById } from './utils/test-order-utils';
 
 describe('Order taxes', () => {
     const { server, adminClient, shopClient } = createTestEnvironment({
@@ -62,7 +63,7 @@ describe('Order taxes', () => {
         });
 
         it('prices are correct', async () => {
-            const variant = products[0].variants[0];
+            const variant = products.sort(sortById)[0].variants.sort(sortById)[0];
             await shopClient.query<AddItemToOrder.Mutation, AddItemToOrder.Variables>(ADD_ITEM_TO_ORDER, {
                 productVariantId: variant.id,
                 quantity: 2,

+ 1 - 1
packages/core/e2e/shop-catalog.e2e-spec.ts

@@ -96,7 +96,7 @@ describe('Shop catalog', () => {
                 }
             `);
 
-            expect(result.products.items.map(item => item.id)).toEqual(['T_2', 'T_3', 'T_4']);
+            expect(result.products.items.map(item => item.id).sort()).toEqual(['T_2', 'T_3', 'T_4']);
         });
 
         it('by id', async () => {