test(tools): pin the raw near-360 satellite azimuths and list the tools with the heading helper

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
quanticsoul4772andClaude Opus 5.5 committed 2026-11-05 05:43:42 -08:00
1 parent a1cee50d86
commit df87419e64
3 files changed
+23 -6

No files matched your search

+1
View File
@@ -71,6 +71,7 @@ function weatherRow(weather) {
precipitation_mm: weather.precipitationMm ?? null,
cloud_cover_pct: weather.cloudCoverPct ?? null,
wind_kph: weather.windKph ?? null,
// Raw Open-Meteo value, like the fields above; it reports north as 360.
wind_direction_deg: weather.windDirectionDeg ?? null,
visibility_m: weather.visibilityM ?? null,
};
+18 -1
View File
@@ -2,6 +2,10 @@ import assert from 'node:assert/strict';
import test from 'node:test';
import { twoline2satrec } from 'satellite.js';
import { composeCatalog, coreTools } from '../index.js';
import {
findNextSatellitePass,
lookAnglesAt,
} from '../../data/satellitePass.js';
import {
noradIdFromSatnum,
parseTleText,
@@ -301,7 +305,20 @@ test('satellite azimuths that round to 360 read as 0', async () => {
tools: coreTools,
services: { satellites: satellites(), clock: CLOCK },
});
// From these points the ISS rises at 359.7° and stands at 359.8° at CLOCK.
// These points are chosen so the ISS's raw azimuths fall just below 360°;
// pin that first, so the test cannot pass on a raw value already near 0.
const [, line1, line2] = TLE.split('\n');
const iss = twoline2satrec(line1, line2);
const nearNorth = (deg) => deg > 359.5 && deg < 360;
const rawPass = findNextSatellitePass({
satrec: iss,
latDeg: 10,
lonDeg: 30,
fromMs: CLOCK.now(),
});
assert.ok(nearNorth(rawPass.riseAzDeg), `rise ${rawPass.riseAzDeg}°`);
const rawLook = lookAnglesAt(iss, CLOCK.now(), 39.25, 65.75);
assert.ok(nearNorth(rawLook.azDeg), `azimuth ${rawLook.azDeg}°`);
const pass = await catalog.call('next_satellite_pass', {
location: { lat: 10, lon: 30 },
});