diff --git a/test/objects/star.test.ts b/test/objects/star.test.ts index b358bf7..b713191 100644 --- a/test/objects/star.test.ts +++ b/test/objects/star.test.ts @@ -4,8 +4,8 @@ * @since 3.0.0 */ -import { Star } from '@src/objects'; -import { Degrees, Kilometers, Radians } from '@src/ootk'; +import { Star } from '../../lib/objects'; +import { Degrees, Kilometers, Radians } from '../../lib/ootk'; describe('Basic Star functionality', () => { const star = new Star({ diff --git a/test/sat/sat.test.js b/test/sat/sat.test.js index cc0847d..88904df 100644 --- a/test/sat/sat.test.js +++ b/test/sat/sat.test.js @@ -4,7 +4,7 @@ * @since 1.2.0 */ -import { Sat } from '../../lib/ootk'; +import { Satellite } from '../../lib/ootk'; import { RAD2DEG } from '../../lib/utils/constants'; const dateObj = new Date(1661400000000); @@ -14,7 +14,7 @@ const tle2 = '2 25544 51.6415 161.8339 0005168 35.9781 54.7009 15.50067047350 describe('Basic Satellite functionality', () => { it('should create a new Sat object', () => { - const sat = new Sat({ name: 'Test', tle1, tle2 }); + const sat = new Satellite({ name: 'Test', tle1, tle2 }); expect(sat).toBeDefined(); expect(sat.inclination).toBe(51.6415); @@ -23,7 +23,7 @@ describe('Basic Satellite functionality', () => { }); it('should allow chaining', () => { - const eci = new Sat({ name: 'Test', tle1, tle2 }).propagateTo(dateObj).getEci().position; + const eci = new Satellite({ name: 'Test', tle1, tle2 }).propagateTo(dateObj).getEci().position; expect(eci.x).toBeCloseTo(6512.640035319078); expect(eci.y).toBeCloseTo(-1545.524934684146); @@ -31,7 +31,7 @@ describe('Basic Satellite functionality', () => { }); it('should allow getting eci coordinates', () => { - const sat = new Sat({ name: 'Test', tle1, tle2 }); + const sat = new Satellite({ name: 'Test', tle1, tle2 }); const eci = sat.getEci(dateObj).position; @@ -41,7 +41,7 @@ describe('Basic Satellite functionality', () => { }); it('should allow getting ecf coordinates', () => { - const sat = new Sat({ name: 'Test', tle1, tle2 }); + const sat = new Satellite({ name: 'Test', tle1, tle2 }); const eci = sat.getEcf(dateObj); @@ -51,7 +51,7 @@ describe('Basic Satellite functionality', () => { }); it('should allow getting lla coordinates', () => { - const sat = new Sat({ name: 'Test', tle1, tle2 }); + const sat = new Satellite({ name: 'Test', tle1, tle2 }); const eci = sat.lla(dateObj); @@ -61,7 +61,7 @@ describe('Basic Satellite functionality', () => { }); it('should be able to get the orbital period', () => { - const sat = new Sat({ name: 'Test', tle1, tle2 }); + const sat = new Satellite({ name: 'Test', tle1, tle2 }); expect(sat.period).toBeCloseTo(92.89920734635164); }); diff --git a/test/sat/sensor.test.ts b/test/sat/sensor.test.ts index 3010c5e..b5dc38a 100644 --- a/test/sat/sensor.test.ts +++ b/test/sat/sensor.test.ts @@ -4,7 +4,7 @@ * @since 1.2.0 */ -import { Degrees, Kilometers, Sat, Sensor, SpaceObjectType, TleLine1, TleLine2 } from '../../src/ootk'; +import { Degrees, Kilometers, Satellite, Sensor, SpaceObjectType, TleLine1, TleLine2 } from '../../lib/ootk'; const dateObj = new Date(1661400000000); @@ -12,7 +12,7 @@ const tle1 = '1 25544U 98067A 22203.46960946 .00003068 00000+0 61583-4 0 9 const tle2 = '2 25544 51.6415 161.8339 0005168 35.9781 54.7009 15.50067047350657' as TleLine2; describe('Basic Sensor functionality', () => { - const sat = new Sat({ name: 'Test', tle1, tle2 }); + const sat = new Satellite({ name: 'Test', tle1, tle2 }); it('should be able to get rae coordinates', () => { const sensor = new Sensor({ diff --git a/test/sgp4/legacy/ext.test.js b/test/sgp4/legacy/ext.test.js index c2c4179..941239a 100644 --- a/test/sgp4/legacy/ext.test.js +++ b/test/sgp4/legacy/ext.test.js @@ -3,8 +3,7 @@ * @since 0.2.0 */ -import { Sgp4 } from '@lib/ootk'; -import { compareVectors } from '@test/lib/compareVectors'; +import { Sgp4 } from '../../../lib/ootk'; describe('Julian date / time', () => { // Use number of milliseconds since epoch instead of local year, month, day, etc for consistency across machines diff --git a/test/sgp4/legacy/initl.test.js b/test/sgp4/legacy/initl.test.js index 312cb34..9b98306 100644 --- a/test/sgp4/legacy/initl.test.js +++ b/test/sgp4/legacy/initl.test.js @@ -3,7 +3,7 @@ * @since 0.2.0 */ -import { Sgp4 } from '@lib/ootk'; // eslint-disable-line +import { Sgp4 } from '../../../lib/ootk'; // eslint-disable-line // wgs84 constants const mu = 398600.8; // in km3 / s2 diff --git a/test/sgp4/legacy/io.test.js b/test/sgp4/legacy/io.test.js index af004ec..c1559d6 100644 --- a/test/sgp4/legacy/io.test.js +++ b/test/sgp4/legacy/io.test.js @@ -3,7 +3,7 @@ * @since 0.2.0 */ -import { Sgp4 } from '@lib/ootk'; // eslint-disable-line +import { Sgp4 } from '../../../src/ootk'; // eslint-disable-line import badTleData from './io.json'; describe('Twoline', () => { diff --git a/test/sgp4/rsr/rsr3.test.js b/test/sgp4/rsr/rsr3.test.js index ec17ec4..29252fb 100644 --- a/test/sgp4/rsr/rsr3.test.js +++ b/test/sgp4/rsr/rsr3.test.js @@ -8,10 +8,10 @@ * sgp4Data is from https://www.celestrak.com/publications/AIAA/2006-6753/AIAA-2006-6753-Rev1.pdf * Only using the first and last state vectors for verification */ -import { Sgp4 } from '@lib/ootk'; -import { compareVectors } from '@test/lib/compareVectors'; -import sgp4Data from './rsr3.json'; +import { Sgp4 } from '../../../lib/ootk'; +import { compareVectors } from '../../lib/compareVectors'; import sgp4FailData from './rsr3-fail.json'; +import sgp4Data from './rsr3.json'; describe('Verification TLE Data in Appendix D of Revisiting Spacetrack Report #3: Rev 1', () => { sgp4Data.forEach((sgp4DataItem) => { diff --git a/test/sgp4/sgp4-full-cov.test.js b/test/sgp4/sgp4-full-cov.test.js index db2a5fb..695f16d 100644 --- a/test/sgp4/sgp4-full-cov.test.js +++ b/test/sgp4/sgp4-full-cov.test.js @@ -4,7 +4,7 @@ * @since 0.2.0 */ -import { Sgp4 } from '@lib/ootk'; +import { Sgp4 } from '../../lib/ootk'; import sgp4FailData from './sgp4-full-cov-fail.json'; import sgp4Data from './sgp4-full-cov.json'; diff --git a/test/tle/tle.test.js b/test/tle/tle.test.js index bc73225..04baced 100644 --- a/test/tle/tle.test.js +++ b/test/tle/tle.test.js @@ -5,7 +5,7 @@ * @since 1.1.0 */ -import { Tle } from '@lib/ootk'; +import { Tle } from '../../lib/ootk'; import tleData from './tle.json'; describe('Valid TLEs', () => { diff --git a/test/transforms/transforms.test.js b/test/transforms/transforms.test.js index c644ede..8870693 100644 --- a/test/transforms/transforms.test.js +++ b/test/transforms/transforms.test.js @@ -1,9 +1,21 @@ /** - * @file Tests from Transforms.js to ensure compatibility + * @file Tests from js to ensure compatibility * @since 0.2.0 */ -import { Transforms } from '../../lib/ootk'; +import { + ecf2eci, + ecf2rae, + eci2ecf, + eci2lla, + getDegLat, + getDegLon, + getRadLat, + getRadLon, + lla2ecf, + rae2ecf, + rae2sez, +} from '../../lib/ootk'; import { RAD2DEG } from '../../lib/utils/constants'; import transformData from './transforms.json'; @@ -24,25 +36,25 @@ describe('Latitude & longitude conversions', () => { validLatitudes.forEach((item) => { it(`convert valid latitude value (${item.radians} radians) to degrees`, () => { - expect(Transforms.getDegLat(item.radians)).toBeCloseTo(item.degrees, numDigits); + expect(getDegLat(item.radians)).toBeCloseTo(item.degrees, numDigits); }); it(`convert valid latitude value (${item.degrees} degrees) to radians`, () => { - expect(Transforms.getRadLat(item.degrees)).toBeCloseTo(item.radians, numDigits); + expect(getRadLat(item.degrees)).toBeCloseTo(item.radians, numDigits); }); }); validLongitudes.forEach((item) => { it(`convert valid longitude value (${item.radians} radians) to degrees`, () => { - expect(Transforms.getDegLon(item.radians)).toBeCloseTo(item.degrees, numDigits); + expect(getDegLon(item.radians)).toBeCloseTo(item.degrees, numDigits); }); it(`convert valid longitude value (${item.degrees} degrees) to radians`, () => { - expect(Transforms.getRadLon(item.degrees)).toBeCloseTo(item.radians, numDigits); + expect(getRadLon(item.degrees)).toBeCloseTo(item.radians, numDigits); }); }); validGeodeticToEcf.forEach((item) => { it('convert valid LLA coordinates to ECF', () => { - const ecfCoordinates = Transforms.lla2ecf(item.lla); + const ecfCoordinates = lla2ecf(item.lla); expect(ecfCoordinates.x).toBeCloseTo(item.ecf.x); expect(ecfCoordinates.y).toBeCloseTo(item.ecf.y); @@ -52,7 +64,7 @@ describe('Latitude & longitude conversions', () => { validEciToGeodetic.forEach((item) => { it('convert valid ECI coordinates to LLA', () => { - const llaCoordinates = Transforms.eci2lla(item.eci, item.gmst); + const llaCoordinates = eci2lla(item.eci, item.gmst); expect(llaCoordinates.lon).toBeCloseTo(item.lla.lon * RAD2DEG); expect(llaCoordinates.lat).toBeCloseTo(item.lla.lat * RAD2DEG); @@ -62,7 +74,7 @@ describe('Latitude & longitude conversions', () => { validEciToEcf.forEach((item) => { it('convert valid ECI coordinates to ECF', () => { - const ecfCoordinates = Transforms.eci2ecf(item.eci, item.gmst); + const ecfCoordinates = eci2ecf(item.eci, item.gmst); expect(ecfCoordinates.x).toBeCloseTo(item.ecf.x); expect(ecfCoordinates.y).toBeCloseTo(item.ecf.y); @@ -72,7 +84,7 @@ describe('Latitude & longitude conversions', () => { validEcfToEci.forEach((item) => { it('convert valid ECF coordinates to ECI', () => { - const eciCoordinates = Transforms.ecf2eci(item.ecf, item.gmst); + const eciCoordinates = ecf2eci(item.ecf, item.gmst); expect(eciCoordinates.x).toBeCloseTo(item.eci.x); expect(eciCoordinates.y).toBeCloseTo(item.eci.y); @@ -82,7 +94,7 @@ describe('Latitude & longitude conversions', () => { validEcfToLookangles.forEach((item) => { it('convert valid ECF coordinates to RAE', () => { - const raeCoordinates = Transforms.ecf2rae(item.lla, item.satelliteEcf); + const raeCoordinates = ecf2rae(item.lla, item.satelliteEcf); expect(raeCoordinates.rng).toBeCloseTo(item.rae.rng, 0); expect(raeCoordinates.az).toBeCloseTo(item.rae.az * RAD2DEG, 1); @@ -92,19 +104,19 @@ describe('Latitude & longitude conversions', () => { invalidLatitudes.forEach((item) => { it(`convert invalid latitude value (${item.radians} radians) to degrees`, () => { - expect(() => Transforms.getDegLat(item.radians)).toThrowError(RangeError); + expect(() => getDegLat(item.radians)).toThrowError(RangeError); }); it(`convert invalid latitude value (${item.degrees} degrees) to radians`, () => { - expect(() => Transforms.getRadLat(item.degrees)).toThrowError(RangeError); + expect(() => getRadLat(item.degrees)).toThrowError(RangeError); }); }); invalidLongitudes.forEach((item) => { it(`convert invalid longitude value (${item.radians} radians) to degrees`, () => { - expect(() => Transforms.getDegLon(item.radians)).toThrowError(RangeError); + expect(() => getDegLon(item.radians)).toThrowError(RangeError); }); it(`convert invalid longitude value (${item.degrees} degrees) to radians`, () => { - expect(() => Transforms.getRadLon(item.degrees)).toThrowError(RangeError); + expect(() => getRadLon(item.degrees)).toThrowError(RangeError); }); }); }); @@ -112,7 +124,7 @@ describe('Latitude & longitude conversions', () => { describe('Rae2Sez', () => { it('should convert valid RAE coordinates to SEZ', () => { const { rae, sez } = transformData.validRae2Sez[0]; - const sezCoordinates = Transforms.rae2sez(rae); + const sezCoordinates = rae2sez(rae); expect(sezCoordinates.s).toBeCloseTo(sez.s); expect(sezCoordinates.e).toBeCloseTo(sez.e); @@ -133,12 +145,12 @@ describe('Rae2Ecf', () => { lat: 0, alt: 0, }; - const rae = Transforms.ecf2rae(lla, ecf); + const rae = ecf2rae(lla, ecf); // eslint-disable-next-line no-console console.warn(rae); - const ecfCoordinates = Transforms.rae2ecf(rae, lla); + const ecfCoordinates = rae2ecf(rae, lla); expect(ecfCoordinates.x).toBeCloseTo(ecf.x); expect(ecfCoordinates.y).toBeCloseTo(ecf.y); diff --git a/test/utils/utils.test.js b/test/utils/utils.test.js index 246ad6d..4eab81c 100644 --- a/test/utils/utils.test.js +++ b/test/utils/utils.test.js @@ -3,8 +3,8 @@ * @since 1.0.0-alpha3 */ -import { Utils } from '@lib/ootk'; // eslint-disable-line -import { getDayOfYear } from '@lib/utils/functions'; +import { Utils } from '../../lib/ootk'; // eslint-disable-line +import { getDayOfYear } from '../../lib/utils/functions'; const numDigits = 8;