-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.js
37 lines (28 loc) · 771 Bytes
/
test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import {strictEqual as eql, ok} from 'node:assert'
import {fetchPosition} from './lib/fetch-position.js'
{
const _ = await fetchPosition()
console.info(_)
eql(typeof _.latitude, 'number')
ok(!Number.isNaN(_.latitude))
ok(_.latitude >= -90)
ok(_.latitude <= 90)
eql(typeof _.longitude, 'number')
ok(!Number.isNaN(_.longitude))
ok(_.longitude >= -180)
ok(_.longitude <= 180)
eql(typeof _.altitude, 'number')
ok(!Number.isNaN(_.altitude))
ok(_.altitude >= -5000)
ok(_.altitude <= 15000)
eql(typeof _.speed, 'number')
ok(!Number.isNaN(_.speed))
ok(_.speed >= 0)
ok(_.speed <= 1500)
// todo: _.cmg
ok(Number.isInteger(_.nrOfSatellites))
ok(_.nrOfSatellites >= 0)
ok(_.nrOfSatellites <= 100)
// todo: _.mode
console.info('looks good ✔︎')
}