Skip to content

Commit 9f5c3b9

Browse files
committed
add tests for basics variables
1 parent dc802bf commit 9f5c3b9

File tree

3 files changed

+20
-62
lines changed

3 files changed

+20
-62
lines changed

index.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
<head>
44
<meta charset="utf-8">
55

6-
<title>JavaScript Classes Travel</title>
7-
<meta name="description" content="Classes Travel in the Learn.co curriculum">
6+
<title>Basics Variables Lab</title>
7+
<meta name="description" content="Basics Variables Lab in the Learn.co curriculum">
88
<meta name="author" content="Flatiron School">
99

1010
<link rel="stylesheet" href="node_modules/mocha/mocha.css">

index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+

test/indexTest.js

Lines changed: 17 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -1,76 +1,33 @@
11
const expect = chai.expect;
22

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')
347
})
35-
})
368

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)
4211
})
4312
})
4413

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')
5017
})
51-
})
5218

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)
5821
})
5922
})
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')
6627
})
67-
})
6828

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)
7331
})
7432
})
75-
7633
})

0 commit comments

Comments
 (0)