test(launches): cover null top-level landing coordinates

Signed-off-by: Rudy Celekli <[email protected]>
This commit is contained in:
Rudy Celekli committed 2026-10-16 23:19:12 -04:00
1 parent 0d8caaafd8
commit d3e11bfbca
3 files changed
+14 -8

No files matched your search

+10 -4
View File
@@ -676,7 +676,7 @@ test('uses Launch Library 2 pad latitude/longitude fields', () => {
assert.equal(launches[0].lon, -120.611);
});
test('null or blank pad and landing coordinates stay unknown instead of becoming 0', () => {
test('null or blank pad coordinates stay unknown instead of becoming 0', () => {
const base = { net: '2026-07-20T10:00:00Z' };
for (const blank of [null, '', ' ', false]) {
assert.deepEqual(
@@ -684,15 +684,21 @@ test('null or blank pad and landing coordinates stay unknown instead of becoming
[],
);
}
// Null pad fields fall through to the location's "lon,lat" pair, not 0,0.
});
test('null pad coordinates use the location fallback instead of 0,0', () => {
const base = { net: '2026-07-20T10:00:00Z' };
const [fallback] = normalizeRocketLaunches([{ ...base, id: 'fallback',
pad: { latitude: null, longitude: null, location: { coordinates: '-80.6,28.6' } } }], NOW);
assert.equal(fallback.lat, 28.6);
assert.equal(fallback.lon, -80.6);
// An undisclosed landing keeps position, distance and flight number unknown.
});
test('an undisclosed landing keeps top-level position and stage numbers unknown', () => {
const base = { net: '2026-07-20T10:00:00Z' };
const [launch] = normalizeRocketLaunches([{ ...base, id: 'landing', pad: { latitude: 1, longitude: 2 },
rocket: { launcher_stage: [{ launcher_flight_number: null,
landing: { attempt: true, downrange_distance: null,
landing: { attempt: true, latitude: null, longitude: null, downrange_distance: null,
landing_location: { latitude: null, longitude: null } } }] } }], NOW);
const [stage] = launch.recoveryStages;
assert.equal(stage.lat, null);