worldmap-viewer

git clone https://git.godosa.eu/worldmap-viewer

master

raw · 669 bytes

import './_planet.mjs';
import { test } from 'node:test';
import assert from 'node:assert/strict';
import { dayLabel, momentLabel, daylightLabel, SKY_LINES } from '../js/skypanel.js';

test('labels', () => {
  assert.equal(dayLabel(54), 'day 54 of 216 · northern midsummer');
  assert.equal(dayLabel(30), 'day 30 of 216');
  assert.equal(momentLabel(23328), 'moment 23,328 of 46,656');
  assert.equal(daylightLabel(0, 30), 'daylight 50% (15.6 h)');
});

test('tropics and polar circles', () => {
  assert.deepEqual(SKY_LINES.map(l => l[0].lat), [20, -20, 70, -70]);
  assert.ok(SKY_LINES.every(l => l.length === 181 && l[0].lon === -180 && l.at(-1).lon === 180));
});