mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-04 10:24:02 +00:00
formatCockpitWindDirection rounded the bearing and printed that number, so wind from 359.5° or more read "N · 360°". Take the rounded degrees modulo 360 so north reads 0°.
11 lines
456 B
JavaScript
11 lines
456 B
JavaScript
import test from 'node:test';
|
|
import assert from 'node:assert/strict';
|
|
import { formatCockpitWindDirection } from './cockpitPresentation.js';
|
|
|
|
test('wind just west of north reads 0°, not 360°', () => {
|
|
assert.equal(formatCockpitWindDirection(90), 'E · 90°');
|
|
assert.equal(formatCockpitWindDirection(0), 'N · 0°');
|
|
assert.equal(formatCockpitWindDirection(359.4), 'N · 359°');
|
|
assert.equal(formatCockpitWindDirection(359.6), 'N · 0°');
|
|
});
|