-
Notifications
You must be signed in to change notification settings - Fork 885
/
airport-test.js
65 lines (46 loc) · 3.03 KB
/
airport-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
55
56
57
58
59
60
61
62
63
64
65
var assert = require('chai').assert;
var { createAirport, welcomeGuests, landPlanes, checkAirlineLocations } = require('./airport');
describe('Airport', function() {
it.skip('should create an airport', function() {
var airport = createAirport('Denver International Airport', ['United', 'Southwest', 'Delta'], 144);
assert.equal(airport.name, 'Denver International Airport');
assert.equal(airport.availableGates, 144);
assert.equal(airport.airlines[0], 'United');
});
it.skip('should welcome people to the airport', function() {
var denverAirport = createAirport('Denver International Airport', ['United', 'Southwest', 'Delta'], 144);
var sanDiegoAirport = createAirport('San Diego International Airport', ['Frontier', 'American'], 48);
var denverWelcome = welcomeGuests(denverAirport);
var sanDiegoWelcome = welcomeGuests(sanDiegoAirport);
assert.equal(denverWelcome, 'Welcome to Denver International Airport!');
assert.equal(sanDiegoWelcome, 'Welcome to San Diego International Airport!');
});
it.skip('should keep track of open gates', function() {
var bakersfieldAirport = createAirport('Meadows Field Airport', ['United', 'American'], 12);
var sanDiegoAirport = createAirport('San Diego International Airport', ['Frontier', 'American'], 48);
var bakersfieldGates = landPlanes(bakersfieldAirport, 11);
var sanDiegoGates = landPlanes(sanDiegoAirport, 2);
assert.equal(bakersfieldGates.availableGates, 1);
assert.equal(sanDiegoGates.availableGates, 46);
});
it.skip('should not be able to occupy more gates than available', function() {
var columbusAiport = createAirport('John Glenn Airport', ['Southwest', 'Frontier'], 24);
var updatedAirportGates = landPlanes(columbusAiport, 22);
assert.equal(updatedAirportGates.availableGates, 2);
assert.equal(updatedAirportGates.message, 'Success! Current availability is 2.')
var updatedAirportGates2 = landPlanes(updatedAirportGates, 3);
assert.equal(updatedAirportGates2.availableGates, 0);
assert.equal(updatedAirportGates2.message, 'Oh no! Not enough gates available. Current overflow is 1.')
});
it.skip('should be able to tell you where an airline flies to', function() {
var columbusAiport = createAirport('John Glenn Airport', ['Southwest', 'Frontier'], 24);
var bakersfieldAirport = createAirport('Meadows Field Airport', ['United', 'American'], 12);
var sanDiegoAirport = createAirport('San Diego International Airport', ['Frontier', 'American'], 48);
var denverAirport = createAirport('Denver International Airport', ['United', 'Southwest', 'Delta'], 144);
var allAirports = [columbusAiport, bakersfieldAirport, sanDiegoAirport, denverAirport];
var southwestCarriers = checkAirlineLocations(allAirports, 'Southwest');
var unitedCarriers = checkAirlineLocations(allAirports, 'United');
assert.deepEqual(southwestCarriers, ['John Glenn Airport', 'Denver International Airport']);
assert.deepEqual(unitedCarriers, ['Meadows Field Airport', 'Denver International Airport']);
});
});