import test from 'node:test'; import assert from 'node:assert/strict'; import { createCycloneSource, validateCycloneSnapshot, CYCLONE_RESPONSE_LIMIT, } from './source.js'; const issuedAt = '2026-09-16T03:00:00.000Z'; function fixture() { return { schemaVersion: 1, source: 'NOAA NHC / CPHC', attribution: 'NOAA/NWS', coverage: 'Atlantic and eastern/central North Pacific', fetchedAt: Date.parse(issuedAt), stale: false, unavailable: false, reason: null, storms: [ { id: 'ep152026', name: 'Fifteen-E', classification: 'PTC', basin: 'EP', position: { longitude: -125.8, latitude: 15.5 }, positionAt: issuedAt, issuedAt, advisoryNumber: '10', windKt: 25, pressureHpa: 1006, movement: { directionDegrees: null, speedKt: null }, advisoryUrl: 'https://www.nhc.noaa.gov/text/MIATCMEP5.shtml', outlookUrl: 'https://www.nhc.noaa.gov/gtwo.php?basin=epac&fdays=7', geometryStatus: 'pending', geometryAdvisoryNumber: null, forecastPoints: [], track: null, cone: null, }, ], }; } function current() { const value = fixture(), storm = value.storms[0]; storm.geometryStatus = 'current'; storm.geometryAdvisoryNumber = '10'; storm.forecastPoints = [ { position: { longitude: 179, latitude: 15 }, tauHours: 12, windKt: 30, gustKt: 40, }, ]; storm.track = { type: 'MultiLineString', coordinates: [ [ [179, 15], [-179, 16], ], [ [170, 14], [179, 15], ], ], }; storm.cone = { type: 'MultiPolygon', coordinates: [ [ [ [178, 10], [-178, 10], [-178, 20], [178, 10], ], [ [179, 12], [-179, 12], [-179, 14], [179, 12], ], ], [ [ [170, 1], [171, 1], [171, 2], [170, 1], ], ], ], }; return value; } test('cyclone projection preserves MultiPolygon holes/dateline and separates advisory from position time', () => { const value = current(); value.storms[0].positionAt = '2026-09-16T03:30:00.000Z'; value.storms[0].cone.properties = { html: '