fix(firms): drop the decimal when fire power rounds to 10 MW

A 9.96 MW detection was labeled 10.0 MW because the one-decimal cutoff ran before rounding.
This commit is contained in:
Rudy Celekli committed 2026-10-24 00:23:11 -04:00
1 parent 9d3548c27c
commit 2beef9be39
4 files changed
+40 -3

No files matched your search

+9
View File
@@ -6,6 +6,7 @@ import {
FIRMS_AMBIENT_COHORT_LIMIT,
FIRMS_OVERLAY_SOURCE_ID,
satelliteShortName,
formatFrpMw,
} from './firmsLabels.js';
test('FIRMS formatting helpers retain the shipped severity palette', () => {
@@ -15,6 +16,14 @@ test('FIRMS formatting helpers retain the shipped severity palette', () => {
assert.equal(accentForSeverity('chartreuse'), accentForSeverity('yellow'));
});
test('FIRMS power that rounds to 10 MW drops the decimal', () => {
assert.equal(formatFrpMw(9.96), '10');
assert.equal(formatFrpMw(9.94), '9.9');
assert.equal(formatFrpMw(0.8), '0.8');
assert.equal(formatFrpMw(1520.27), '1520');
assert.equal(formatFrpMw(210.4), '210');
});
test('FIRMS satellite names retain the three VIIRS abbreviations', () => {
assert.equal(satelliteShortName('N20'), 'N20');
assert.equal(satelliteShortName('N21'), 'N21');