-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.js
54 lines (47 loc) · 1.28 KB
/
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
/* global describe, it */
const assert = require('assert')
const { struct } = require('superstruct')
const chartSupplements = require('./index')
const Result = struct({
ident: 'string',
city: 'string',
state: 'string',
airport: 'string',
navAid: 'string',
chart: 'string',
volBackPages: {
name: 'string',
url: 'string'
},
airportNavAidListing: {
name: 'string',
url: 'string'
}
})
describe('chart supplements', () => {
it('should fetch chart supplements for a single ICAO', () => {
return chartSupplements('PANC').then(cs => {
Result(cs)
})
})
it('should fetch chart supplements for an array of ICAOs', () => {
return chartSupplements(['PANC', 'PABV']).then(cs => {
assert.strictEqual(cs.length, 2)
cs.map(cs => Result(cs))
})
})
it('should expose the list method', () => {
return chartSupplements.list('PANC')
})
it('should expose the fetchCurrentCycle method', () => {
return chartSupplements.fetchCurrentCycle().then(cycle => {
assert(parseInt(cycle))
})
})
it('should fetch chart supplements for an array of ICAOs using the list method', () => {
return chartSupplements.list(['PANC', 'PABV']).then(cs => {
assert.strictEqual(cs.length, 2)
cs.map(cs => Result(cs))
})
})
})