Browse Source

chore(test): Fix broken e2e tests

Michael Bromley 2 years ago
parent
commit
e7d3aec2a4

+ 8 - 8
e2e-common/jest-config.js

@@ -14,15 +14,15 @@ module.exports = {
     testRegex: '.e2e-spec.ts$',
     maxWorkers: process.env.CI ? 1 : 3,
     transform: {
-        '^.+\\.ts$': 'ts-jest',
+        '^.+\\.ts$': [
+            'ts-jest',
+            {
+                tsconfig: '<rootDir>/config/tsconfig.e2e.json',
+                diagnostics: false,
+                isolatedModules: true,
+            },
+        ],
     },
     testEnvironment: 'node',
     reporters: ['default', path.join(__dirname, 'custom-reporter.js')],
-    globals: {
-        'ts-jest': {
-            tsconfig: '<rootDir>/config/tsconfig.e2e.json',
-            diagnostics: false,
-            isolatedModules: true,
-        },
-    },
 };

+ 3 - 3
package.json

@@ -38,7 +38,7 @@
     "@graphql-codegen/typescript": "3.0.1",
     "@graphql-codegen/typescript-operations": "3.0.1",
     "@graphql-tools/schema": "^8.3.1",
-    "@types/jest": "^26.0.20",
+    "@types/jest": "^29.4.0",
     "@types/klaw-sync": "^6.0.0",
     "@types/node": "^14.14.31",
     "concurrently": "^6.0.0",
@@ -46,12 +46,12 @@
     "find": "^0.3.0",
     "graphql": "16.3.0",
     "husky": "^4.3.0",
-    "jest": "^27.0.6",
+    "jest": "^29.4.3",
     "klaw-sync": "^6.0.0",
     "lerna": "^4.0.0",
     "lint-staged": "^10.5.4",
     "prettier": "^2.2.1",
-    "ts-jest": "^27.0.4",
+    "ts-jest": "^29.0.5",
     "ts-node": "^10.9.1",
     "tslint": "^6.1.3",
     "typescript": "4.9.5"

+ 10 - 10
packages/core/e2e/__snapshots__/administrator.e2e-spec.ts.snap

@@ -1,21 +1,21 @@
 // Jest Snapshot v1, https://goo.gl/fbAQLP
 
 exports[`Administrator resolver createAdministrator 1`] = `
-Object {
+{
   "emailAddress": "test@test.com",
   "firstName": "First",
   "id": "T_2",
   "lastName": "Last",
-  "user": Object {
+  "user": {
     "id": "T_3",
     "identifier": "test@test.com",
     "lastLogin": null,
-    "roles": Array [
-      Object {
+    "roles": [
+      {
         "code": "__super_admin_role__",
         "description": "SuperAdmin",
         "id": "T_1",
-        "permissions": Array [
+        "permissions": [
           "Authenticated",
           "SuperAdmin",
           "UpdateGlobalSettings",
@@ -111,21 +111,21 @@ Object {
 `;
 
 exports[`Administrator resolver updateAdministrator 1`] = `
-Object {
+{
   "emailAddress": "new-email",
   "firstName": "new first",
   "id": "T_2",
   "lastName": "new last",
-  "user": Object {
+  "user": {
     "id": "T_3",
     "identifier": "new-email",
     "lastLogin": null,
-    "roles": Array [
-      Object {
+    "roles": [
+      {
         "code": "__customer_role__",
         "description": "Customer",
         "id": "T_2",
-        "permissions": Array [
+        "permissions": [
           "Authenticated",
         ],
       },

+ 30 - 30
packages/core/e2e/__snapshots__/collection.e2e-spec.ts.snap

@@ -1,9 +1,9 @@
 // Jest Snapshot v1, https://goo.gl/fbAQLP
 
 exports[`Collection resolver createCollection creates a root collection 1`] = `
-Object {
-  "assets": Array [
-    Object {
+{
+  "assets": [
+    {
       "fileSize": 1680,
       "id": "T_2",
       "mimeType": "image/jpeg",
@@ -12,7 +12,7 @@ Object {
       "source": "test-url/test-assets/alexandru-acea-686569-unsplash.jpg",
       "type": "IMAGE",
     },
-    Object {
+    {
       "fileSize": 1680,
       "id": "T_1",
       "mimeType": "image/jpeg",
@@ -22,9 +22,9 @@ Object {
       "type": "IMAGE",
     },
   ],
-  "children": Array [],
+  "children": [],
   "description": "",
-  "featuredAsset": Object {
+  "featuredAsset": {
     "fileSize": 1680,
     "id": "T_1",
     "mimeType": "image/jpeg",
@@ -33,14 +33,14 @@ Object {
     "source": "test-url/test-assets/derick-david-409858-unsplash.jpg",
     "type": "IMAGE",
   },
-  "filters": Array [
-    Object {
-      "args": Array [
-        Object {
+  "filters": [
+    {
+      "args": [
+        {
           "name": "facetValueIds",
-          "value": "[\\"T_1\\"]",
+          "value": "["T_1"]",
         },
-        Object {
+        {
           "name": "containsAny",
           "value": "false",
         },
@@ -52,13 +52,13 @@ Object {
   "isPrivate": false,
   "languageCode": "en",
   "name": "Electronics",
-  "parent": Object {
+  "parent": {
     "id": "T_1",
     "name": "__root_collection__",
   },
   "slug": "electronics",
-  "translations": Array [
-    Object {
+  "translations": [
+    {
       "description": "",
       "id": "T_3",
       "languageCode": "en",
@@ -70,9 +70,9 @@ Object {
 `;
 
 exports[`Collection resolver updateCollection updates with assets 1`] = `
-Object {
-  "assets": Array [
-    Object {
+{
+  "assets": [
+    {
       "fileSize": 1680,
       "id": "T_1",
       "mimeType": "image/jpeg",
@@ -81,7 +81,7 @@ Object {
       "source": "test-url/test-assets/derick-david-409858-unsplash.jpg",
       "type": "IMAGE",
     },
-    Object {
+    {
       "fileSize": 1680,
       "id": "T_3",
       "mimeType": "image/jpeg",
@@ -91,9 +91,9 @@ Object {
       "type": "IMAGE",
     },
   ],
-  "children": Array [],
+  "children": [],
   "description": "Apple stuff ",
-  "featuredAsset": Object {
+  "featuredAsset": {
     "fileSize": 1680,
     "id": "T_1",
     "mimeType": "image/jpeg",
@@ -102,14 +102,14 @@ Object {
     "source": "test-url/test-assets/derick-david-409858-unsplash.jpg",
     "type": "IMAGE",
   },
-  "filters": Array [
-    Object {
-      "args": Array [
-        Object {
+  "filters": [
+    {
+      "args": [
+        {
           "name": "facetValueIds",
-          "value": "[\\"T_3\\"]",
+          "value": "["T_3"]",
         },
-        Object {
+        {
           "name": "containsAny",
           "value": "false",
         },
@@ -121,13 +121,13 @@ Object {
   "isPrivate": false,
   "languageCode": "en",
   "name": "Pear",
-  "parent": Object {
+  "parent": {
     "id": "T_4",
     "name": "Computers",
   },
   "slug": "apple-stuff",
-  "translations": Array [
-    Object {
+  "translations": [
+    {
       "description": "Apple stuff ",
       "id": "T_5",
       "languageCode": "en",

+ 8 - 8
packages/core/e2e/__snapshots__/facet.e2e-spec.ts.snap

@@ -1,31 +1,31 @@
 // Jest Snapshot v1, https://goo.gl/fbAQLP
 
 exports[`Facet resolver createFacet 1`] = `
-Object {
+{
   "code": "speaker-type",
   "id": "T_2",
   "isPrivate": false,
   "languageCode": "en",
   "name": "Speaker Type",
-  "translations": Array [
-    Object {
+  "translations": [
+    {
       "id": "T_2",
       "languageCode": "en",
       "name": "Speaker Type",
     },
   ],
-  "values": Array [
-    Object {
+  "values": [
+    {
       "code": "portable",
-      "facet": Object {
+      "facet": {
         "id": "T_2",
         "name": "Speaker Type",
       },
       "id": "T_7",
       "languageCode": "en",
       "name": "Portable",
-      "translations": Array [
-        Object {
+      "translations": [
+        {
           "id": "T_7",
           "languageCode": "en",
           "name": "Portable",

+ 135 - 135
packages/core/e2e/__snapshots__/import.e2e-spec.ts.snap

@@ -1,35 +1,35 @@
 // Jest Snapshot v1, https://goo.gl/fbAQLP
 
 exports[`Import resolver imports products 1`] = `
-Object {
-  "assets": Array [
-    Object {
+{
+  "assets": [
+    {
       "id": "T_1",
       "name": "pps1.jpg",
       "preview": "test-url/test-assets/pps1__preview.jpg",
       "source": "test-url/test-assets/pps1.jpg",
     },
-    Object {
+    {
       "id": "T_2",
       "name": "pps2.jpg",
       "preview": "test-url/test-assets/pps2__preview.jpg",
       "source": "test-url/test-assets/pps2.jpg",
     },
   ],
-  "customFields": Object {
-    "keywords": Array [
+  "customFields": {
+    "keywords": [
       "paper",
       "stretching",
       "watercolor",
     ],
     "localName": "localPPS",
-    "owner": Object {
+    "owner": {
       "id": "T_1",
     },
     "pageType": "default",
   },
   "description": "A great device for stretching paper.",
-  "featuredAsset": Object {
+  "featuredAsset": {
     "id": "T_1",
     "name": "pps1.jpg",
     "preview": "test-url/test-assets/pps1__preview.jpg",
@@ -37,18 +37,18 @@ Object {
   },
   "id": "T_1",
   "name": "Perfect Paper Stretcher",
-  "optionGroups": Array [
-    Object {
+  "optionGroups": [
+    {
       "code": "perfect-paper-stretcher-size",
       "id": "T_1",
       "name": "size",
     },
   ],
   "slug": "perfect-paper-stretcher",
-  "variants": Array [
-    Object {
-      "assets": Array [],
-      "customFields": Object {
+  "variants": [
+    {
+      "assets": [],
+      "customFields": {
         "valid": null,
         "weight": 100,
       },
@@ -57,19 +57,19 @@ Object {
       "name": "Perfect Paper Stretcher Half Imperial",
       "price": 4530,
       "sku": "PPS12",
-      "stockMovements": Object {
-        "items": Array [],
+      "stockMovements": {
+        "items": [],
       },
       "stockOnHand": 0,
-      "taxCategory": Object {
+      "taxCategory": {
         "id": "T_1",
         "name": "Standard Tax",
       },
       "trackInventory": "FALSE",
     },
-    Object {
-      "assets": Array [],
-      "customFields": Object {
+    {
+      "assets": [],
+      "customFields": {
         "valid": null,
         "weight": 100,
       },
@@ -78,19 +78,19 @@ Object {
       "name": "Perfect Paper Stretcher Quarter Imperial",
       "price": 3250,
       "sku": "PPS14",
-      "stockMovements": Object {
-        "items": Array [],
+      "stockMovements": {
+        "items": [],
       },
       "stockOnHand": 0,
-      "taxCategory": Object {
+      "taxCategory": {
         "id": "T_1",
         "name": "Standard Tax",
       },
       "trackInventory": "FALSE",
     },
-    Object {
-      "assets": Array [],
-      "customFields": Object {
+    {
+      "assets": [],
+      "customFields": {
         "valid": null,
         "weight": 100,
       },
@@ -99,9 +99,9 @@ Object {
       "name": "Perfect Paper Stretcher Full Imperial",
       "price": 5950,
       "sku": "PPSF",
-      "stockMovements": Object {
-        "items": Array [
-          Object {
+      "stockMovements": {
+        "items": [
+          {
             "id": "T_1",
             "quantity": -10,
             "type": "ADJUSTMENT",
@@ -109,7 +109,7 @@ Object {
         ],
       },
       "stockOnHand": -10,
-      "taxCategory": Object {
+      "taxCategory": {
         "id": "T_1",
         "name": "Standard Tax",
       },
@@ -120,12 +120,12 @@ Object {
 `;
 
 exports[`Import resolver imports products 2`] = `
-Object {
-  "assets": Array [],
-  "customFields": Object {
-    "keywords": Array [],
+{
+  "assets": [],
+  "customFields": {
+    "keywords": [],
     "localName": "localMabef",
-    "owner": Object {
+    "owner": {
       "id": "T_1",
     },
     "pageType": "expanded",
@@ -134,12 +134,12 @@ Object {
   "featuredAsset": null,
   "id": "T_2",
   "name": "Mabef M/02 Studio Easel",
-  "optionGroups": Array [],
+  "optionGroups": [],
   "slug": "mabef-m02-studio-easel",
-  "variants": Array [
-    Object {
-      "assets": Array [],
-      "customFields": Object {
+  "variants": [
+    {
+      "assets": [],
+      "customFields": {
         "valid": null,
         "weight": 300,
       },
@@ -148,9 +148,9 @@ Object {
       "name": "Mabef M/02 Studio Easel",
       "price": 91070,
       "sku": "M02",
-      "stockMovements": Object {
-        "items": Array [
-          Object {
+      "stockMovements": {
+        "items": [
+          {
             "id": "T_2",
             "quantity": 100,
             "type": "ADJUSTMENT",
@@ -158,7 +158,7 @@ Object {
         ],
       },
       "stockOnHand": 100,
-      "taxCategory": Object {
+      "taxCategory": {
         "id": "T_1",
         "name": "Standard Tax",
       },
@@ -169,12 +169,12 @@ Object {
 `;
 
 exports[`Import resolver imports products 3`] = `
-Object {
-  "assets": Array [],
-  "customFields": Object {
-    "keywords": Array [],
+{
+  "assets": [],
+  "customFields": {
+    "keywords": [],
     "localName": "localGiotto",
-    "owner": Object {
+    "owner": {
       "id": "T_1",
     },
     "pageType": "default",
@@ -183,29 +183,29 @@ Object {
   "featuredAsset": null,
   "id": "T_3",
   "name": "Giotto Mega Pencils",
-  "optionGroups": Array [
-    Object {
+  "optionGroups": [
+    {
       "code": "giotto-mega-pencils-box-size",
       "id": "T_2",
       "name": "box size",
     },
   ],
   "slug": "giotto-mega-pencils",
-  "variants": Array [
-    Object {
-      "assets": Array [
-        Object {
+  "variants": [
+    {
+      "assets": [
+        {
           "id": "T_3",
           "name": "box-of-8.jpg",
           "preview": "test-url/test-assets/box-of-8__preview.jpg",
           "source": "test-url/test-assets/box-of-8.jpg",
         },
       ],
-      "customFields": Object {
+      "customFields": {
         "valid": null,
         "weight": 200,
       },
-      "featuredAsset": Object {
+      "featuredAsset": {
         "id": "T_3",
         "name": "box-of-8.jpg",
         "preview": "test-url/test-assets/box-of-8__preview.jpg",
@@ -215,30 +215,30 @@ Object {
       "name": "Giotto Mega Pencils Box of 8",
       "price": 416,
       "sku": "225400",
-      "stockMovements": Object {
-        "items": Array [],
+      "stockMovements": {
+        "items": [],
       },
       "stockOnHand": 0,
-      "taxCategory": Object {
+      "taxCategory": {
         "id": "T_1",
         "name": "Standard Tax",
       },
       "trackInventory": "FALSE",
     },
-    Object {
-      "assets": Array [
-        Object {
+    {
+      "assets": [
+        {
           "id": "T_4",
           "name": "box-of-12.jpg",
           "preview": "test-url/test-assets/box-of-12__preview.jpg",
           "source": "test-url/test-assets/box-of-12.jpg",
         },
       ],
-      "customFields": Object {
+      "customFields": {
         "valid": null,
         "weight": 200,
       },
-      "featuredAsset": Object {
+      "featuredAsset": {
         "id": "T_4",
         "name": "box-of-12.jpg",
         "preview": "test-url/test-assets/box-of-12__preview.jpg",
@@ -248,11 +248,11 @@ Object {
       "name": "Giotto Mega Pencils Box of 12",
       "price": 624,
       "sku": "225600",
-      "stockMovements": Object {
-        "items": Array [],
+      "stockMovements": {
+        "items": [],
       },
       "stockOnHand": 0,
-      "taxCategory": Object {
+      "taxCategory": {
         "id": "T_1",
         "name": "Standard Tax",
       },
@@ -263,15 +263,15 @@ Object {
 `;
 
 exports[`Import resolver imports products 4`] = `
-Object {
-  "assets": Array [],
-  "customFields": Object {
-    "keywords": Array [
+{
+  "assets": [],
+  "customFields": {
+    "keywords": [
       "apron",
       "clothing",
     ],
     "localName": "localSmock",
-    "owner": Object {
+    "owner": {
       "id": "T_1",
     },
     "pageType": "default",
@@ -280,23 +280,23 @@ Object {
   "featuredAsset": null,
   "id": "T_4",
   "name": "Artists Smock",
-  "optionGroups": Array [
-    Object {
+  "optionGroups": [
+    {
       "code": "artists-smock-size",
       "id": "T_3",
       "name": "size",
     },
-    Object {
+    {
       "code": "artists-smock-colour",
       "id": "T_4",
       "name": "colour",
     },
   ],
   "slug": "artists-smock",
-  "variants": Array [
-    Object {
-      "assets": Array [],
-      "customFields": Object {
+  "variants": [
+    {
+      "assets": [],
+      "customFields": {
         "valid": true,
         "weight": 500,
       },
@@ -305,19 +305,19 @@ Object {
       "name": "Artists Smock small beige",
       "price": 1199,
       "sku": "10112",
-      "stockMovements": Object {
-        "items": Array [],
+      "stockMovements": {
+        "items": [],
       },
       "stockOnHand": 0,
-      "taxCategory": Object {
+      "taxCategory": {
         "id": "T_2",
         "name": "Reduced Tax",
       },
       "trackInventory": "FALSE",
     },
-    Object {
-      "assets": Array [],
-      "customFields": Object {
+    {
+      "assets": [],
+      "customFields": {
         "valid": false,
         "weight": 500,
       },
@@ -326,19 +326,19 @@ Object {
       "name": "Artists Smock large beige",
       "price": 1199,
       "sku": "10113",
-      "stockMovements": Object {
-        "items": Array [],
+      "stockMovements": {
+        "items": [],
       },
       "stockOnHand": 0,
-      "taxCategory": Object {
+      "taxCategory": {
         "id": "T_2",
         "name": "Reduced Tax",
       },
       "trackInventory": "FALSE",
     },
-    Object {
-      "assets": Array [],
-      "customFields": Object {
+    {
+      "assets": [],
+      "customFields": {
         "valid": null,
         "weight": 500,
       },
@@ -347,19 +347,19 @@ Object {
       "name": "Artists Smock small navy",
       "price": 1199,
       "sku": "10114",
-      "stockMovements": Object {
-        "items": Array [],
+      "stockMovements": {
+        "items": [],
       },
       "stockOnHand": 0,
-      "taxCategory": Object {
+      "taxCategory": {
         "id": "T_2",
         "name": "Reduced Tax",
       },
       "trackInventory": "FALSE",
     },
-    Object {
-      "assets": Array [],
-      "customFields": Object {
+    {
+      "assets": [],
+      "customFields": {
         "valid": true,
         "weight": 500,
       },
@@ -368,19 +368,19 @@ Object {
       "name": "Artists Smock large navy",
       "price": 1199,
       "sku": "10115",
-      "stockMovements": Object {
-        "items": Array [],
+      "stockMovements": {
+        "items": [],
       },
       "stockOnHand": 0,
-      "taxCategory": Object {
+      "taxCategory": {
         "id": "T_2",
         "name": "Reduced Tax",
       },
       "trackInventory": "FALSE",
     },
-    Object {
-      "assets": Array [],
-      "customFields": Object {
+    {
+      "assets": [],
+      "customFields": {
         "valid": false,
         "weight": null,
       },
@@ -389,11 +389,11 @@ Object {
       "name": "Artists Smock large navy",
       "price": 1199,
       "sku": "10115",
-      "stockMovements": Object {
-        "items": Array [],
+      "stockMovements": {
+        "items": [],
       },
       "stockOnHand": 0,
-      "taxCategory": Object {
+      "taxCategory": {
         "id": "T_2",
         "name": "Reduced Tax",
       },
@@ -404,10 +404,10 @@ Object {
 `;
 
 exports[`Import resolver imports products with multiple languages 1`] = `
-Object {
-  "assets": Array [],
-  "customFields": Object {
-    "keywords": Array [
+{
+  "assets": [],
+  "customFields": {
+    "keywords": [
       "paper, stretch",
     ],
     "localName": "纸张拉伸器",
@@ -418,18 +418,18 @@ Object {
   "featuredAsset": null,
   "id": "T_5",
   "name": "奇妙的纸张拉伸器",
-  "optionGroups": Array [
-    Object {
+  "optionGroups": [
+    {
       "code": "fantastic-paper-stretcher-size",
       "id": "T_5",
       "name": "size",
     },
   ],
   "slug": "奇妙的纸张拉伸器",
-  "variants": Array [
-    Object {
-      "assets": Array [],
-      "customFields": Object {
+  "variants": [
+    {
+      "assets": [],
+      "customFields": {
         "weight": 243,
       },
       "featuredAsset": null,
@@ -437,9 +437,9 @@ Object {
       "name": "奇妙的纸张拉伸器 半英制",
       "price": 4530,
       "sku": "PPS12",
-      "stockMovements": Object {
-        "items": Array [
-          Object {
+      "stockMovements": {
+        "items": [
+          {
             "id": "T_3",
             "quantity": 10,
             "type": "ADJUSTMENT",
@@ -447,15 +447,15 @@ Object {
         ],
       },
       "stockOnHand": 10,
-      "taxCategory": Object {
+      "taxCategory": {
         "id": "T_1",
         "name": "Standard Tax",
       },
       "trackInventory": "FALSE",
     },
-    Object {
-      "assets": Array [],
-      "customFields": Object {
+    {
+      "assets": [],
+      "customFields": {
         "weight": 344,
       },
       "featuredAsset": null,
@@ -463,9 +463,9 @@ Object {
       "name": "奇妙的纸张拉伸器 四分之一英制",
       "price": 3250,
       "sku": "PPS14",
-      "stockMovements": Object {
-        "items": Array [
-          Object {
+      "stockMovements": {
+        "items": [
+          {
             "id": "T_4",
             "quantity": 10,
             "type": "ADJUSTMENT",
@@ -473,15 +473,15 @@ Object {
         ],
       },
       "stockOnHand": 10,
-      "taxCategory": Object {
+      "taxCategory": {
         "id": "T_1",
         "name": "Standard Tax",
       },
       "trackInventory": "FALSE",
     },
-    Object {
-      "assets": Array [],
-      "customFields": Object {
+    {
+      "assets": [],
+      "customFields": {
         "weight": 656,
       },
       "featuredAsset": null,
@@ -489,9 +489,9 @@ Object {
       "name": "奇妙的纸张拉伸器 全英制",
       "price": 5950,
       "sku": "PPSF",
-      "stockMovements": Object {
-        "items": Array [
-          Object {
+      "stockMovements": {
+        "items": [
+          {
             "id": "T_5",
             "quantity": 10,
             "type": "ADJUSTMENT",
@@ -499,7 +499,7 @@ Object {
         ],
       },
       "stockOnHand": 10,
-      "taxCategory": Object {
+      "taxCategory": {
         "id": "T_1",
         "name": "Standard Tax",
       },

+ 22 - 22
packages/core/e2e/__snapshots__/product.e2e-spec.ts.snap

@@ -1,31 +1,31 @@
 // Jest Snapshot v1, https://goo.gl/fbAQLP
 
 exports[`Product resolver product mutation createProduct creates a new Product 1`] = `
-Object {
-  "assets": Array [],
-  "channels": Array [
-    Object {
+{
+  "assets": [],
+  "channels": [
+    {
       "code": "__default_channel__",
       "id": "T_1",
     },
   ],
   "description": "A baked potato",
   "enabled": true,
-  "facetValues": Array [],
+  "facetValues": [],
   "featuredAsset": null,
   "id": "T_22",
   "languageCode": "en",
   "name": "en Baked Potato",
-  "optionGroups": Array [],
+  "optionGroups": [],
   "slug": "en-baked-potato",
-  "variants": Array [],
+  "variants": [],
 }
 `;
 
 exports[`Product resolver product query returns expected properties 1`] = `
-Object {
-  "assets": Array [
-    Object {
+{
+  "assets": [
+    {
       "fileSize": 1680,
       "id": "T_2",
       "mimeType": "image/jpeg",
@@ -35,27 +35,27 @@ Object {
       "type": "IMAGE",
     },
   ],
-  "channels": Array [
-    Object {
+  "channels": [
+    {
       "code": "__default_channel__",
       "id": "T_1",
     },
   ],
   "description": "Discover a truly immersive viewing experience with this monitor curved more deeply than any other. Wrapping around your field of vision the 1,800 R screencreates a wider field of view, enhances depth perception, and minimises peripheral distractions to draw you deeper in to your content.",
   "enabled": true,
-  "facetValues": Array [
-    Object {
+  "facetValues": [
+    {
       "code": "electronics",
-      "facet": Object {
+      "facet": {
         "id": "T_1",
         "name": "category",
       },
       "id": "T_1",
       "name": "electronics",
     },
-    Object {
+    {
       "code": "computers",
-      "facet": Object {
+      "facet": {
         "id": "T_1",
         "name": "category",
       },
@@ -63,7 +63,7 @@ Object {
       "name": "computers",
     },
   ],
-  "featuredAsset": Object {
+  "featuredAsset": {
     "fileSize": 1680,
     "id": "T_2",
     "mimeType": "image/jpeg",
@@ -75,8 +75,8 @@ Object {
   "id": "T_2",
   "languageCode": "en",
   "name": "Curvy Monitor",
-  "optionGroups": Array [
-    Object {
+  "optionGroups": [
+    {
       "code": "curvy-monitor-monitor-size",
       "id": "T_3",
       "languageCode": "en",
@@ -84,8 +84,8 @@ Object {
     },
   ],
   "slug": "curvy-monitor",
-  "translations": Array [
-    Object {
+  "translations": [
+    {
       "description": "Discover a truly immersive viewing experience with this monitor curved more deeply than any other. Wrapping around your field of vision the 1,800 R screencreates a wider field of view, enhances depth perception, and minimises peripheral distractions to draw you deeper in to your content.",
       "languageCode": "en",
       "name": "Curvy Monitor",

+ 34 - 34
packages/core/e2e/__snapshots__/promotion.e2e-spec.ts.snap

@@ -1,10 +1,10 @@
 // Jest Snapshot v1, https://goo.gl/fbAQLP
 
 exports[`Promotion resolver adjustmentOperations 1`] = `
-Array [
-  Object {
-    "args": Array [
-      Object {
+[
+  {
+    "args": [
+      {
         "name": "facetValueIds",
         "type": "ID",
         "ui": null,
@@ -17,10 +17,10 @@ Array [
 `;
 
 exports[`Promotion resolver adjustmentOperations 2`] = `
-Array [
-  Object {
-    "args": Array [
-      Object {
+[
+  {
+    "args": [
+      {
         "name": "arg",
         "type": "int",
         "ui": null,
@@ -29,9 +29,9 @@ Array [
     "code": "promo_condition",
     "description": "description for promo_condition",
   },
-  Object {
-    "args": Array [
-      Object {
+  {
+    "args": [
+      {
         "name": "arg",
         "type": "int",
         "ui": null,
@@ -44,22 +44,22 @@ Array [
 `;
 
 exports[`Promotion resolver createPromotion 1`] = `
-Object {
-  "actions": Array [
-    Object {
-      "args": Array [
-        Object {
+{
+  "actions": [
+    {
+      "args": [
+        {
           "name": "facetValueIds",
-          "value": "[\\"T_1\\"]",
+          "value": "["T_1"]",
         },
       ],
       "code": "promo_action",
     },
   ],
-  "conditions": Array [
-    Object {
-      "args": Array [
-        Object {
+  "conditions": [
+    {
+      "args": [
+        {
           "name": "arg",
           "value": "500",
         },
@@ -76,31 +76,31 @@ Object {
 `;
 
 exports[`Promotion resolver updatePromotion 1`] = `
-Object {
-  "actions": Array [
-    Object {
-      "args": Array [
-        Object {
+{
+  "actions": [
+    {
+      "args": [
+        {
           "name": "facetValueIds",
-          "value": "[\\"T_1\\"]",
+          "value": "["T_1"]",
         },
       ],
       "code": "promo_action",
     },
   ],
-  "conditions": Array [
-    Object {
-      "args": Array [
-        Object {
+  "conditions": [
+    {
+      "args": [
+        {
           "name": "arg",
           "value": "90",
         },
       ],
       "code": "promo_condition",
     },
-    Object {
-      "args": Array [
-        Object {
+    {
+      "args": [
+        {
           "name": "arg",
           "value": "10",
         },

+ 7 - 7
packages/core/jest.config.js

@@ -5,14 +5,14 @@ module.exports = {
     rootDir: __dirname,
     roots: ['<rootDir>/src', '<rootDir>/mock-data'],
     transform: {
-        '^.+\\.(t|j)s$': 'ts-jest',
-    },
-    globals: {
-        'ts-jest': {
-            tsconfig: {
-                allowJs: true,
+        '^.+\\.(t|j)s$': [
+            'ts-jest',
+            {
+                tsconfig: {
+                    allowJs: true,
+                },
             },
-        },
+        ],
     },
     testEnvironment: 'node',
 };

File diff suppressed because it is too large
+ 285 - 285
packages/core/src/data-import/providers/import-parser/__snapshots__/import-parser.spec.ts.snap


+ 5 - 7
packages/core/src/data-import/providers/importer/fast-importer.service.ts

@@ -182,13 +182,11 @@ export class FastImporterService {
                 .getRepository(this.importCtx, ProductVariantAsset)
                 .save(variantAssets, { reload: false });
         }
-        if (input.stockOnHand != null && input.stockOnHand !== 0) {
-            await this.stockMovementService.adjustProductVariantStock(
-                this.importCtx,
-                createdVariant.id,
-                input.stockOnHand,
-            );
-        }
+        await this.stockMovementService.adjustProductVariantStock(
+            this.importCtx,
+            createdVariant.id,
+            input.stockOnHand ?? 0,
+        );
         const assignedChannelIds = unique([this.defaultChannel, this.importCtx.channel], 'id').map(c => c.id);
         for (const channelId of assignedChannelIds) {
             const variantPrice = new ProductVariantPrice({

+ 6 - 15
packages/core/src/service/helpers/translatable-saver/translation-differ.spec.ts

@@ -1,9 +1,9 @@
 import { LanguageCode } from '@vendure/common/lib/generated-types';
 
 import { TranslationInput } from '../../../common/types/locale-types';
+import { TransactionalConnection } from '../../../connection/index';
 import { ProductTranslation } from '../../../entity/product/product-translation.entity';
 import { Product } from '../../../entity/product/product.entity';
-import { MockEntityManager } from '../../../testing/connection.mock';
 
 import { TranslationDiffer } from './translation-differ';
 
@@ -26,10 +26,10 @@ describe('TranslationUpdater', () => {
             }),
         ];
 
-        let entityManager: any;
+        let connection: any;
 
         beforeEach(() => {
-            entityManager = new MockEntityManager() as any;
+            connection = {};
         });
 
         it('correctly marks translations for update', async () => {
@@ -48,10 +48,7 @@ describe('TranslationUpdater', () => {
                 },
             ];
 
-            const diff = new TranslationDiffer(ProductTranslation as any, entityManager).diff(
-                existing,
-                updated,
-            );
+            const diff = new TranslationDiffer(ProductTranslation as any, connection).diff(existing, updated);
             expect(diff.toUpdate).toEqual(existing);
         });
 
@@ -70,10 +67,7 @@ describe('TranslationUpdater', () => {
                     description: '',
                 },
             ];
-            const diff = new TranslationDiffer(ProductTranslation as any, entityManager).diff(
-                existing,
-                updated,
-            );
+            const diff = new TranslationDiffer(ProductTranslation as any, connection).diff(existing, updated);
             expect(diff.toAdd).toEqual(updated);
         });
 
@@ -92,10 +86,7 @@ describe('TranslationUpdater', () => {
                     description: '',
                 },
             ];
-            const diff = new TranslationDiffer(ProductTranslation as any, entityManager).diff(
-                existing,
-                updated,
-            );
+            const diff = new TranslationDiffer(ProductTranslation as any, connection).diff(existing, updated);
             expect(diff.toUpdate).toEqual([existing[0]]);
             expect(diff.toAdd).toEqual([updated[1]]);
         });

+ 0 - 41
packages/core/src/testing/connection.mock.ts

@@ -1,41 +0,0 @@
-import { Type } from '@vendure/common/lib/shared-types';
-import { AbstractRepository, EntityManager, Repository } from 'typeorm';
-
-import { MockClass } from './testing-types';
-
-export class MockEntityManager implements MockClass<EntityManager> {
-    connection: any = {};
-    queryRunner: any = {};
-    transaction = jest.fn();
-    query = jest.fn();
-    createQueryBuilder = jest.fn();
-    hasId = jest.fn();
-    getId = jest.fn();
-    create = jest.fn();
-    merge = jest.fn();
-    preload = jest.fn();
-    save = jest.fn();
-    remove = jest.fn();
-    insert = jest.fn();
-    update = jest.fn();
-    delete = jest.fn();
-    softDelete = jest.fn();
-    softRemove = jest.fn();
-    restore = jest.fn();
-    recover = jest.fn();
-    count = jest.fn();
-    find = jest.fn();
-    findAndCount = jest.fn();
-    findByIds = jest.fn();
-    findOne = jest.fn();
-    findOneOrFail = jest.fn();
-    clear = jest.fn();
-    increment = jest.fn();
-    decrement = jest.fn();
-    getRepository = jest.fn();
-    getTreeRepository = jest.fn();
-    getMongoRepository = jest.fn();
-    getCustomRepository = jest.fn();
-    release = jest.fn();
-    upsert = jest.fn();
-}

+ 8 - 8
packages/elasticsearch-plugin/jest.config.js

@@ -5,15 +5,15 @@ module.exports = {
     rootDir: __dirname,
     roots: ['<rootDir>/src'],
     transform: {
-        '^.+\\.(t|j)s$': 'ts-jest',
-    },
-    globals: {
-        'ts-jest': {
-            tsconfig: {
-                allowJs: true,
-                skipLibCheck: true,
+        '^.+\\.(t|j)s$': [
+            'ts-jest',
+            {
+                tsconfig: {
+                    allowJs: true,
+                    skipLibCheck: true,
+                },
             },
-        },
+        ],
     },
     testEnvironment: 'node',
 };

+ 9 - 9
packages/email-plugin/jest.config.js

@@ -5,16 +5,16 @@ module.exports = {
     rootDir: __dirname,
     roots: ['<rootDir>/src'],
     transform: {
-        '^.+\\.(t|j)s$': 'ts-jest',
-    },
-    globals: {
-        'ts-jest': {
-            isolatedModules: true,
-            tsconfig: {
-                allowJs: true,
-                skipLibCheck: true,
+        '^.+\\.(t|j)s$': [
+            'ts-jest',
+            {
+                isolatedModules: true,
+                tsconfig: {
+                    allowJs: true,
+                    skipLibCheck: true,
+                },
             },
-        },
+        ],
     },
     testEnvironment: 'node',
 };

+ 8 - 8
packages/job-queue-plugin/jest.config.js

@@ -5,15 +5,15 @@ module.exports = {
     rootDir: __dirname,
     roots: ['<rootDir>/src'],
     transform: {
-        '^.+\\.(t|j)s$': 'ts-jest',
-    },
-    globals: {
-        'ts-jest': {
-            tsconfig: {
-                allowJs: true,
-                skipLibCheck: true,
+        '^.+\\.(t|j)s$': [
+            'ts-jest',
+            {
+                tsconfig: {
+                    allowJs: true,
+                    skipLibCheck: true,
+                },
             },
-        },
+        ],
     },
     testEnvironment: 'node',
 };

+ 8 - 3
packages/payments-plugin/e2e/mollie-payment.e2e-spec.ts

@@ -1,5 +1,5 @@
 import { OrderStatus } from '@mollie/api-client';
-import { ChannelService, mergeConfig, OrderService, RequestContext } from '@vendure/core';
+import { ChannelService, LanguageCode, mergeConfig, OrderService, RequestContext } from '@vendure/core';
 import {
     SettlePaymentMutation,
     SettlePaymentMutationVariables,
@@ -190,8 +190,6 @@ describe('Mollie payments', () => {
         >(CREATE_PAYMENT_METHOD, {
             input: {
                 code: mockData.methodCode,
-                name: 'Mollie payment test',
-                description: 'This is a Mollie test payment method',
                 enabled: true,
                 handler: {
                     code: molliePaymentHandler.code,
@@ -201,6 +199,13 @@ describe('Mollie payments', () => {
                         { name: 'autoCapture', value: 'false' },
                     ],
                 },
+                translations: [
+                    {
+                        languageCode: LanguageCode.en,
+                        name: 'Mollie payment test',
+                        description: 'This is a Mollie test payment method',
+                    },
+                ],
             },
         });
         expect(createPaymentMethod.code).toBe(mockData.methodCode);

+ 8 - 3
packages/payments-plugin/e2e/stripe-payment.e2e-spec.ts

@@ -8,7 +8,7 @@ import nock from 'nock';
 import path from 'path';
 
 import { initialData } from '../../../e2e-common/e2e-initial-data';
-import { testConfig, TEST_SETUP_TIMEOUT_MS } from '../../../e2e-common/test-config';
+import { TEST_SETUP_TIMEOUT_MS, testConfig } from '../../../e2e-common/test-config';
 import { StripePlugin } from '../src/stripe';
 import { stripePaymentMethodHandler } from '../src/stripe/stripe.handler';
 
@@ -98,13 +98,18 @@ describe('Stripe payments', () => {
         >(CREATE_PAYMENT_METHOD, {
             input: {
                 code: `stripe-payment-${E2E_DEFAULT_CHANNEL_TOKEN}`,
-                name: 'Stripe payment test',
-                description: 'This is a Stripe test payment method',
                 enabled: true,
                 handler: {
                     code: stripePaymentMethodHandler.code,
                     arguments: [],
                 },
+                translations: [
+                    {
+                        languageCode: LanguageCode.en,
+                        name: 'Stripe payment test',
+                        description: 'This is a Stripe test payment method',
+                    },
+                ],
             },
         });
         expect(createPaymentMethod.code).toBe(`stripe-payment-${E2E_DEFAULT_CHANNEL_TOKEN}`);

File diff suppressed because it is too large
+ 421 - 567
yarn.lock


Some files were not shown because too many files changed in this diff