-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
409 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import { exampleDate } from '../lib/mockData'; | ||
import { ClassicalElements, EpochUTC, J2000, Kilometers, Radians, TEME, Vector3D } from './../../src/main'; | ||
describe('TEME', () => { | ||
let stateVector: TEME; | ||
|
||
beforeEach(() => { | ||
stateVector = new J2000( | ||
EpochUTC.fromDateTime(new Date(1705109326817)), | ||
new Vector3D(1538.223335842895 as Kilometers, 5102.261204021967 as Kilometers, 4432.634965003577 as Kilometers), | ||
new Vector3D( | ||
-7.341518909379302 as Kilometers, | ||
0.6516718453998644 as Kilometers, | ||
1.7933882499861993 as Kilometers, | ||
), | ||
).toTEME(); | ||
}); | ||
|
||
// name | ||
it('should return the name of the coordinate system', () => { | ||
expect(stateVector.name).toMatchSnapshot(); | ||
}); | ||
|
||
// inertial | ||
it('should return whether the coordinate system is inertial', () => { | ||
expect(stateVector.inertial).toMatchSnapshot(); | ||
}); | ||
|
||
// fromClassicalElements | ||
it('should create a TEME coordinate from classical orbital elements', () => { | ||
const epoch = EpochUTC.fromDateTime(exampleDate); | ||
const elements = new ClassicalElements({ | ||
epoch, | ||
semimajorAxis: 6943.547853722985 as Kilometers, | ||
eccentricity: 0.0011235968124658146, | ||
inclination: 0.7509087232045765 as Radians, | ||
rightAscension: 0.028239555738616327 as Radians, | ||
argPerigee: 2.5386411901807353 as Radians, | ||
trueAnomaly: 0.5931399364974058 as Radians, | ||
}); | ||
|
||
expect(TEME.fromClassicalElements(elements)).toMatchSnapshot(); | ||
}); | ||
|
||
// toJ2000 | ||
it('should convert the TEME coordinates to J2000 coordinates', () => { | ||
expect(stateVector.toJ2000()).toMatchSnapshot(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
import { exampleDate } from '../lib/mockData'; | ||
import { ClassicalElements, EpochUTC, Kilometers, Radians, Tle, TleLine1, TleLine2 } from '../../src/main'; | ||
|
||
describe('Tle', () => { | ||
let tle: Tle; | ||
|
||
beforeEach(() => { | ||
// Sample TLE | ||
const tle1 = '1 56006U 23042W 24012.45049317 .00000296 00000-0 36967-4 0 9992' as TleLine1; | ||
const tle2 = '2 56006 143.0043 13.3620 0001137 267.5965 92.4747 15.02542972 44491' as TleLine2; | ||
|
||
tle = new Tle(tle1, tle2); | ||
}); | ||
|
||
// toString | ||
it('should return the TLE as a string', () => { | ||
expect(tle.toString()).toMatchSnapshot(); | ||
}); | ||
|
||
// semiMajorAxis | ||
it('should return the semi-major axis', () => { | ||
expect(tle.semimajorAxis).toMatchSnapshot(); | ||
}); | ||
|
||
// eccentricity | ||
it('should return the eccentricity', () => { | ||
expect(tle.eccentricity).toMatchSnapshot(); | ||
}); | ||
|
||
// inclination | ||
it('should return the inclination', () => { | ||
expect(tle.inclination).toMatchSnapshot(); | ||
}); | ||
|
||
// inclinationDeg | ||
it('should return the inclination in degrees', () => { | ||
expect(tle.inclinationDegrees).toMatchSnapshot(); | ||
}); | ||
|
||
// apogee | ||
it('should return the apogee', () => { | ||
expect(tle.apogee).toMatchSnapshot(); | ||
}); | ||
|
||
// perigee | ||
it('should return the perigee', () => { | ||
expect(tle.perigee).toMatchSnapshot(); | ||
}); | ||
|
||
// period | ||
it('should return the period', () => { | ||
expect(tle.period).toMatchSnapshot(); | ||
}); | ||
|
||
// propagate | ||
it('should propagate the TLE', () => { | ||
const epoch = EpochUTC.fromDateTime(exampleDate); | ||
const propagated = tle.propagate(epoch); | ||
|
||
expect(propagated).toMatchSnapshot(); | ||
}); | ||
|
||
// state | ||
it('should return the state vector', () => { | ||
expect(tle.state).toMatchSnapshot(); | ||
}); | ||
|
||
// fromClassicalElements | ||
it('should create a TLE from classical orbital elements', () => { | ||
const epoch = EpochUTC.fromDateTime(exampleDate); | ||
const elements = new ClassicalElements({ | ||
epoch, | ||
semimajorAxis: 6943.547853722985 as Kilometers, | ||
eccentricity: 0.0011235968124658146, | ||
inclination: 0.7509087232045765 as Radians, | ||
rightAscension: 0.028239555738616327 as Radians, | ||
argPerigee: 2.5386411901807353 as Radians, | ||
trueAnomaly: 0.5931399364974058 as Radians, | ||
}); | ||
const tle = Tle.fromClassicalElements(elements); | ||
|
||
expect(tle).toMatchSnapshot(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`TEME should convert the TEME coordinates to J2000 coordinates 1`] = ` | ||
J2000 { | ||
"epoch": EpochUTC { | ||
"posix": 1705109326.817, | ||
}, | ||
"position": Vector3D { | ||
"x": 1538.2233358428946, | ||
"y": 5102.2612040219665, | ||
"z": 4432.634965003576, | ||
}, | ||
"velocity": Vector3D { | ||
"x": -7.341518909379303, | ||
"y": 0.6516718453998649, | ||
"z": 1.793388249986199, | ||
}, | ||
} | ||
`; | ||
|
||
exports[`TEME should create a TEME coordinate from classical orbital elements 1`] = ` | ||
TEME { | ||
"epoch": EpochUTC { | ||
"posix": 1705109326.817, | ||
}, | ||
"position": Vector3D { | ||
"x": -6935.3813042612455, | ||
"y": -146.1261328371035, | ||
"z": 46.43907991639276, | ||
}, | ||
"velocity": Vector3D { | ||
"x": 0.07740377357485445, | ||
"y": -5.543955093986134, | ||
"z": -5.174123893746047, | ||
}, | ||
} | ||
`; | ||
|
||
exports[`TEME should return the name of the coordinate system 1`] = `"TEME"`; | ||
|
||
exports[`TEME should return whether the coordinate system is inertial 1`] = `true`; |
Oops, something went wrong.