forked from fdesjardins/terminal-procedures
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathtest.js
42 lines (35 loc) · 1.2 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
/* global describe, it */
const assert = require('assert')
const terminalProcedures = require('./index')
describe('terminalProcedures', () => {
it('should fetch terminal procedures for a single ICAO', () => {
return terminalProcedures('PANC').then(procedures => {
assert(procedures)
})
})
it('should fetch terminal procedures for an array of ICAOs', () => {
return terminalProcedures([ 'PANC', 'KSFO' ]).then(procedures => {
assert(procedures.length === 2)
procedures.map(assert)
})
})
it('should expose the list method', () => {
return terminalProcedures.list('PANC')
})
it('should expose the fetchCurrentCycle method', () => {
return terminalProcedures.fetchCurrentCycle().then(cycle => {
assert(parseInt(cycle))
})
})
it('should fetch terminal procedures for an array of ICAOs using the list method', () => {
return terminalProcedures.list([ 'PANC', 'KSFO' ]).then(procedures => {
assert(procedures.length === 2)
procedures.map(assert)
})
})
it('should fetch all terminal procedures on multiple pages', () => {
return terminalProcedures.list('KIAH').then(procedures => {
assert(procedures.length > 50)
})
})
})