mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-04 10:24:02 +00:00
21 lines
817 B
JavaScript
21 lines
817 B
JavaScript
import test from 'node:test';
|
|
import assert from 'node:assert/strict';
|
|
import { normalizeRegionalWeather, weatherCodeLabel } from './regionalModel.js';
|
|
test('missing weather observations never assert clear conditions', () => {
|
|
for (const value of [null, undefined, '', ' ', false, true]) {
|
|
assert.equal(weatherCodeLabel(value), 'CONDITIONS UNKNOWN');
|
|
assert.equal(
|
|
normalizeRegionalWeather({ current: { temperature_2m: value } }),
|
|
null,
|
|
);
|
|
}
|
|
assert.equal(weatherCodeLabel(0), 'CLEAR');
|
|
assert.equal(weatherCodeLabel('0'), 'CLEAR');
|
|
const record = normalizeRegionalWeather({
|
|
current: { temperature_2m: 0, weather_code: null, wind_speed_10m: false },
|
|
});
|
|
assert.equal(record.temperatureC, 0);
|
|
assert.equal(record.weatherCode, null);
|
|
assert.equal(record.windKph, null);
|
|
});
|