|
1 | 1 | const expect = chai.expect;
|
2 | 2 |
|
3 |
| -describe('Arrays', function() { |
4 |
| - beforeEach(() => { |
5 |
| - drivers = ['Milo', 'Otis', 'Garfield']; |
6 |
| - }) |
7 |
| - |
8 |
| - describe('drivers', function() { |
9 |
| - it('defines drivers as `var drivers = ["Milo", "Otis", "Garfield"]`', function() { |
10 |
| - expect(drivers).to.have.ordered.members(["Milo", "Otis", "Garfield"]) |
11 |
| - }) |
12 |
| - }) |
13 |
| - |
14 |
| - describe('destructivelyAppendDriver(name)', function() { |
15 |
| - it('appends a driver to the end of the drivers array', function() { |
16 |
| - destructivelyAppendDriver('Ralph') |
17 |
| - expect(drivers).to.have.ordered.members(["Milo", "Otis", "Garfield", "Ralph"]) |
18 |
| - }) |
19 |
| - }) |
20 |
| - |
21 |
| - describe('destructivelyPrependDriver(name)', function() { |
22 |
| - it('prepends a driver to the beginning of the drivers array', function() { |
23 |
| - destructivelyPrependDriver("Bob") |
24 |
| - |
25 |
| - expect(drivers).to.have.ordered.members(["Bob", "Milo", "Otis", "Garfield"]) |
26 |
| - }) |
27 |
| - }) |
28 |
| - |
29 |
| - describe('destructivelyRemoveLastDriver()', function() { |
30 |
| - it('removes the last driver from the drivers array', function() { |
31 |
| - destructivelyRemoveLastDriver() |
32 |
| - |
33 |
| - expect(drivers).to.have.ordered.members(["Milo", "Otis"]).and.to.not.include('Garfield') |
| 3 | +describe('Uses variable that will not change', function() { |
| 4 | + describe('companyName', function() { |
| 5 | + it('is set as Scuber', () => { |
| 6 | + expect(companyName).to.equal('Scuber') |
34 | 7 | })
|
35 |
| - }) |
36 | 8 |
|
37 |
| - describe('destructivelyRemoveFirstDriver()', function() { |
38 |
| - it('removes the First driver from the drivers array', function() { |
39 |
| - destructivelyRemoveFirstDriver() |
40 |
| - |
41 |
| - expect(drivers).to.have.ordered.members(["Otis", "Garfield"]).and.to.not.include('Milo') |
| 9 | + it('raises error if the companyName is changed', () => { |
| 10 | + expect(() => { companyName = 'specialCompany'}).to.throw(TypeError) |
42 | 11 | })
|
43 | 12 | })
|
44 | 13 |
|
45 |
| - describe('appendDriver(name)', function() { |
46 |
| - it('appends a driver to the drivers array and returns a new array, leaving the drivers array unchanged', function() { |
47 |
| - expect(appendDriver("Broom")).to.have.ordered.members(["Milo", "Otis", "Garfield", "Broom"]) |
48 |
| - |
49 |
| - expect(drivers).to.have.ordered.members(["Milo", "Otis", "Garfield"]) |
| 14 | + describe('mostProfitableNeighborhood', function() { |
| 15 | + it('is declared as equal to Chelsea', function() { |
| 16 | + expect(mostProfitableNeighborhood).to.equal('Chelsea') |
50 | 17 | })
|
51 |
| - }) |
52 | 18 |
|
53 |
| - describe('prependDriver(name)', function() { |
54 |
| - it('prepends a driver to the drivers array and returns a new array, leaving the drivers array unchanged', function() { |
55 |
| - expect(prependDriver("Arnold")).to.have.ordered.members(["Arnold", "Milo", "Otis", "Garfield"]) |
56 |
| - |
57 |
| - expect(drivers).to.have.ordered.members(["Milo", "Otis", "Garfield"]) |
| 19 | + it('does not raise error if the mostProfitableNeighborhood is changed', function(){ |
| 20 | + expect(() => { mostProfitableNeighborhood = 'Upper West Side'}).to.not.throw(TypeError) |
58 | 21 | })
|
59 | 22 | })
|
60 |
| - |
61 |
| - describe('removeLastDriver()', function() { |
62 |
| - it('removes the last driver in the drivers array and returns a new array, leaving the drivers array unchanged', function() { |
63 |
| - expect(removeLastDriver()).to.have.ordered.members(["Milo", "Otis"]) |
64 |
| - |
65 |
| - expect(drivers).to.have.ordered.members(["Milo", "Otis", "Garfield"]) |
| 23 | + |
| 24 | + describe('companyCeo', function() { |
| 25 | + it('is declared as equal to Chelsea', function() { |
| 26 | + expect(companyCeo).to.equal('Susan Smith') |
66 | 27 | })
|
67 |
| - }) |
68 | 28 |
|
69 |
| - describe('removeFirstDriver()', function() { |
70 |
| - it('removes the first driver from the drivers array and returns a new array, leaving the drivers array unchanged', function() { |
71 |
| - expect(removeFirstDriver()).to.have.ordered.members(["Otis", "Garfield"]) |
72 |
| - expect(drivers).to.have.ordered.members(["Milo", "Otis", "Garfield"]) |
| 29 | + it('does not raise error if the companyCeo is changed', function(){ |
| 30 | + expect(() => { companyCeo = 'Lauren Hart'}).to.not.throw(TypeError) |
73 | 31 | })
|
74 | 32 | })
|
75 |
| - |
76 | 33 | })
|
0 commit comments