16 lines
694 B
TypeScript
16 lines
694 B
TypeScript
import test from 'node:test';
|
||
import assert from 'node:assert/strict';
|
||
import { calculateSun, sunriseAzimuth } from '../src/astronomy/sunCalculator.ts';
|
||
import { observer } from '../src/config/observer.ts';
|
||
|
||
test('arrival faces the selected day’s sunrise, even when entering in the afternoon', () => {
|
||
for (const month of ['01', '06', '11']) {
|
||
const date = new Date(`2026-${month}-02T15:00:00+09:00`);
|
||
const state = calculateSun(date, observer);
|
||
const heading = sunriseAzimuth(date, observer);
|
||
assert.equal(heading, calculateSun(state.sunrise!, observer).azimuth);
|
||
assert.ok(heading > 45 && heading < 135);
|
||
assert.ok(Math.abs(heading - state.azimuth) > 60);
|
||
}
|
||
});
|