Skip to content

Commit

Permalink
test: ✅ fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
thkruz committed Jan 13, 2024
1 parent f855124 commit 4248aba
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 3 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,6 @@ jobs:
- run: npm ci --ignore-scripts

- run: npm ci --ignore-scripts

- run: npm run build
test:
needs: build
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
.vscode/settings.json
coverage
/commonjs/
lib
/lib/
node_modules
*.log

Expand Down
17 changes: 17 additions & 0 deletions test/lib/compareVectors.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/**
* Helper from satellite.js to compare vectors
*/

import { Vec3 } from 'lib/ootk-core';

export const compareVectors = (vector1: Vec3, vector2: Vec3, numDigits: number) => {
if (!numDigits) {
expect(vector1.x).toEqual(vector2.x);
expect(vector1.y).toEqual(vector2.y);
expect(vector1.z).toEqual(vector2.z);
} else {
expect(vector1.x).toBeCloseTo(vector2.x, numDigits);
expect(vector1.y).toBeCloseTo(vector2.y, numDigits);
expect(vector1.z).toBeCloseTo(vector2.z, numDigits);
}
};
3 changes: 3 additions & 0 deletions test/sun-moon/sun-moon.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ describe('Sun and Moon', () => {
});

test('getMoonIllumination returns fraction and angle of moons illuminated limb and phase', () => {
// eslint-disable-next-line no-console
console.log('dateObj', dateObj);

const moonIllum = Moon.getMoonIllumination(dateObj);

expect(moonIllum).toMatchSnapshot();
Expand Down

0 comments on commit 4248aba

Please sign in to comment.