test: add unit tests for temperature series visibility policy and peak glow state logic
This commit is contained in:
+46
-36
@@ -230,42 +230,52 @@ export function runTests() {
|
|||||||
"airport-primary weather-station observations should be visible by default",
|
"airport-primary weather-station observations should be visible by default",
|
||||||
);
|
);
|
||||||
|
|
||||||
const amsterdamKnmi = __buildTemperatureChartDataForTest(
|
[
|
||||||
{
|
{ city: "amsterdam", airport: "EHAM", sourceCode: "knmi", sourceLabel: "KNMI" },
|
||||||
city: "amsterdam",
|
{ city: "tel aviv", airport: "LLBG", sourceCode: "ims", sourceLabel: "IMS Lod Airport" },
|
||||||
local_date: "2026-05-29",
|
{ city: "helsinki", airport: "EFHK", sourceCode: "fmi", sourceLabel: "FMI" },
|
||||||
local_time: "17:03",
|
{ city: "tokyo", airport: "RJTT", sourceCode: "jma_amedas", sourceLabel: "JMA" },
|
||||||
tz_offset_seconds: 2 * 60 * 60,
|
{ city: "singapore", airport: "WSSS", sourceCode: "singapore_mss", sourceLabel: "MSS" },
|
||||||
airport: "EHAM",
|
{ city: "panama city", airport: "MPMG", sourceCode: "ncm", sourceLabel: "NCM" },
|
||||||
} as any,
|
{ city: "brussels", airport: "EBBR", sourceCode: "aeroweb", sourceLabel: "AeroWeb" },
|
||||||
{
|
].forEach(({ city: stationCity, airport, sourceCode, sourceLabel }) => {
|
||||||
localTime: "17:03",
|
const stationChart = __buildTemperatureChartDataForTest(
|
||||||
times: ["00:00", "06:00", "12:00", "18:00"],
|
{
|
||||||
temps: [19, 18, 27, 20],
|
city: stationCity,
|
||||||
airportPrimary: {
|
local_date: "2026-05-29",
|
||||||
source_code: "knmi",
|
local_time: "17:03",
|
||||||
source_label: "KNMI",
|
tz_offset_seconds: 2 * 60 * 60,
|
||||||
temp: 19.0,
|
airport,
|
||||||
obs_time: "2026-05-29T15:03:00Z",
|
} as any,
|
||||||
},
|
{
|
||||||
airportPrimaryTodayObs: [
|
localTime: "17:03",
|
||||||
{ time: "2026-05-29T13:00:00Z", temp: 26.2 },
|
times: ["00:00", "06:00", "12:00", "18:00"],
|
||||||
{ time: "2026-05-29T14:00:00Z", temp: 24.5 },
|
temps: [19, 18, 27, 20],
|
||||||
{ time: "2026-05-29T15:00:00Z", temp: 19.9 },
|
airportPrimary: {
|
||||||
],
|
source_code: sourceCode,
|
||||||
} as any,
|
source_label: sourceLabel,
|
||||||
"1D",
|
temp: 19.0,
|
||||||
);
|
obs_time: "2026-05-29T15:03:00Z",
|
||||||
const amsterdamDefaultSeries = __getActiveTemperatureSeriesForTest(
|
},
|
||||||
"amsterdam",
|
airportPrimaryTodayObs: [
|
||||||
amsterdamKnmi.series as any,
|
{ time: "2026-05-29T13:00:00Z", temp: 26.2 },
|
||||||
{},
|
{ time: "2026-05-29T14:00:00Z", temp: 24.5 },
|
||||||
true,
|
{ time: "2026-05-29T15:00:00Z", temp: 19.9 },
|
||||||
);
|
],
|
||||||
assert(
|
} as any,
|
||||||
amsterdamDefaultSeries.some((item: any) => item.key === "madis" && item.label === "KNMI"),
|
"1D",
|
||||||
"Amsterdam KNMI weather-station curve should be visible by default",
|
);
|
||||||
);
|
const stationDefaultSeries = __getActiveTemperatureSeriesForTest(
|
||||||
|
stationCity,
|
||||||
|
stationChart.series as any,
|
||||||
|
{},
|
||||||
|
true,
|
||||||
|
);
|
||||||
|
assert(
|
||||||
|
stationDefaultSeries.some((item: any) => item.key === "madis" && item.label === sourceLabel),
|
||||||
|
`${stationCity} ${sourceLabel} weather-station curve should be visible by default`,
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
const ankaraMgmWithMetarBackup = __buildTemperatureChartDataForTest(
|
const ankaraMgmWithMetarBackup = __buildTemperatureChartDataForTest(
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user