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

-4
View File
@@ -1,9 +1,5 @@
# Changelog # Changelog
- Launch Library records with a null or blank pad latitude/longitude, landing
position, downrange distance or stage flight number now keep those values
unknown instead of reading them as 0, so a launch is no longer placed at
0°N 0°E and an undisclosed landing no longer reports a 0 km downrange.
- Local FM seek finds stations after wrapping around 87.5–108 MHz, covers both - Local FM seek finds stations after wrapping around 87.5–108 MHz, covers both
band edges, skips the starting station and rejects spectra from an earlier band edges, skips the starting station and rejects spectra from an earlier
tune (Aditya, @Rohilalala, #1174). tune (Aditya, @Rohilalala, #1174).
@@ -0,0 +1,4 @@
- Keep missing launch-pad coordinates unknown so launches use the location
fallback or stay off the map instead of appearing at 0°N 0°E. Missing stage
flight numbers no longer show "FLIGHT 0"
(Rudy Celekli, @rudycelekli, #1186).
+10 -4
View File
@@ -676,7 +676,7 @@ test('uses Launch Library 2 pad latitude/longitude fields', () => {
assert.equal(launches[0].lon, -120.611); 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' }; const base = { net: '2026-07-20T10:00:00Z' };
for (const blank of [null, '', ' ', false]) { for (const blank of [null, '', ' ', false]) {
assert.deepEqual( 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', const [fallback] = normalizeRocketLaunches([{ ...base, id: 'fallback',
pad: { latitude: null, longitude: null, location: { coordinates: '-80.6,28.6' } } }], NOW); pad: { latitude: null, longitude: null, location: { coordinates: '-80.6,28.6' } } }], NOW);
assert.equal(fallback.lat, 28.6); assert.equal(fallback.lat, 28.6);
assert.equal(fallback.lon, -80.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 }, const [launch] = normalizeRocketLaunches([{ ...base, id: 'landing', pad: { latitude: 1, longitude: 2 },
rocket: { launcher_stage: [{ launcher_flight_number: null, 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); landing_location: { latitude: null, longitude: null } } }] } }], NOW);
const [stage] = launch.recoveryStages; const [stage] = launch.recoveryStages;
assert.equal(stage.lat, null); assert.equal(stage.lat, null);