From 3b1dffbb50832144d7c3244083b4bef6ca2e3375 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=98ystein=20Lygre?= Date: Tue, 18 Aug 2020 09:26:42 +0200 Subject: [PATCH] fix vector2 issue in test (#348) * fix Vector2 issue in Jest tests * bring back the still working Vector 2 tests * changed to allowSyntheticDefaultImports was a mistake --- test/reference-system.test.ts | 10 +++++++--- tsconfig.json | 1 + 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/test/reference-system.test.ts b/test/reference-system.test.ts index c9b9aaac..b06c635b 100644 --- a/test/reference-system.test.ts +++ b/test/reference-system.test.ts @@ -77,11 +77,13 @@ describe('Reference system', () => { lastPoint = point; } }); - /* TODO: Jest fails due to not finding Vector2 constructor, uncomment when issue is solved it('should have correct number of points', () => { const trajectory = rs.getExtendedTrajectory(100); expect(trajectory.points.length).toEqual(100); }); + + /* TODO: Issue is now solved and tests can be fixed and uncommented + * Jest failed previously due to not finding Vector2 constructor. it('should have same distance between points in extended trajectory', () => { const trajectory = rs.getExtendedTrajectory(200, 500.0, 500.0); const firstDistance = dist(trajectory.points[0], trajectory.points[1]); @@ -100,14 +102,16 @@ describe('Reference system', () => { expect(startExtend).toBeCloseTo(500.0); expect(endExtend).toBeCloseTo(500.0); }); +*/ it('should throw error when parameters are negative', () => { expect(() => { const trajectory = rs.getExtendedTrajectory(100, -50.0, 500.0); - }).toThrow('Invalid parameter, getExtendedTrajectory() must be called with a positive extensionStart parameter'); + }).toThrow('Invalid parameter, getExtendedTrajectory() must be called with a valid and positive extensionStart parameter'); expect(() => { const trajectory = rs.getExtendedTrajectory(100, 50.0, -500.0); - }).toThrow('Invalid parameter, getExtendedTrajectory() must be called with a positive extensionEnd parameter'); + }).toThrow('Invalid parameter, getExtendedTrajectory() must be called with a valid and positive extensionEnd parameter'); }); + /* it('should work for vertical wellbore', () => { const verticalPosLog = [ [30, 40, 100], diff --git a/tsconfig.json b/tsconfig.json index 4410f97b..1867ea79 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -9,6 +9,7 @@ "target": "es5", "resolveJsonModule": true, "allowSyntheticDefaultImports": true, + "esModuleInterop": true }, "include": ["src/**/*"], "exclude": ["node_modules", "dist"]