Przeglądaj źródła

test: Fix ts errors in core tests

Michael Bromley 6 lat temu
rodzic
commit
8cf9fc6714

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

@@ -1,17 +1,17 @@
 module.exports = {
-    coverageDirectory: "coverage",
+    coverageDirectory: 'coverage',
     moduleFileExtensions: [
-        "js",
-        "json",
-        "ts",
+        'js',
+        'json',
+        'ts',
     ],
-    preset: "ts-jest",
+    preset: 'ts-jest',
     rootDir: __dirname,
     roots: [
-        "<rootDir>/src",
-        "<rootDir>/mock-data",
+        '<rootDir>/src',
+        '<rootDir>/mock-data',
     ],
     transform: {
-        "^.+\\.(t|j)s$": "ts-jest",
+        '^.+\\.(t|j)s$': 'ts-jest',
     },
 };

+ 1 - 1
packages/core/src/config/promotion/default-promotion-conditions.ts

@@ -38,7 +38,7 @@ export const atLeastNOfProduct = new PromotionCondition({
     check(order: Order, args) {
         return order.lines.reduce((result, item) => {
             return result || item.quantity >= args.minimum;
-        }, false);
+        }, false as boolean);
     },
 });
 

+ 1 - 1
packages/core/src/service/helpers/order-calculator/order-calculator.ts

@@ -180,7 +180,7 @@ export class OrderCalculator {
                 const allFacetValues = unique([...variant.facetValues, ...variant.product.facetValues], 'id');
                 return facetValueIds.reduce(
                     (result, id) => result && !!allFacetValues.find(fv => idsAreEqual(fv.id, id)),
-                    true,
+                    true as boolean,
                 );
             },
         };

+ 2 - 1
packages/core/tsconfig.json

@@ -5,6 +5,7 @@
     "removeComments": true,
     "strictPropertyInitialization": false,
     "sourceMap": true,
-    "newLine": "LF"
+    "newLine": "LF",
+    "allowJs": true
   }
 }