Skip to content

Commit

Permalink
fix vector2 issue in test (#348)
Browse files Browse the repository at this point in the history
* fix Vector2 issue in Jest tests

* bring back the still working Vector 2 tests

* changed to allowSyntheticDefaultImports was a mistake
  • Loading branch information
ooystein authored Aug 18, 2020
1 parent e6058b3 commit 3b1dffb
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
10 changes: 7 additions & 3 deletions test/reference-system.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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]);
Expand All @@ -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],
Expand Down
1 change: 1 addition & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"target": "es5",
"resolveJsonModule": true,
"allowSyntheticDefaultImports": true,
"esModuleInterop": true
},
"include": ["src/**/*"],
"exclude": ["node_modules", "dist"]
Expand Down

0 comments on commit 3b1dffb

Please sign in to comment.