-
Notifications
You must be signed in to change notification settings - Fork 908
/
index.test.js
60 lines (53 loc) · 2.43 KB
/
index.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
const utils = require('./index')
describe('[Exercise 1] trimProperties', () => {
test('[1] returns an object with the properties trimmed', () => {
// EXAMPLE
const input = { foo: ' foo ', bar: 'bar ', baz: ' baz' }
const expected = { foo: 'foo', bar: 'bar', baz: 'baz' }
const actual = utils.trimProperties(input)
expect(actual).toEqual(expected)
})
// test('[2] returns a copy, leaving the original object intact', () => {})
})
describe('[Exercise 2] trimPropertiesMutation', () => {
// test('[3] returns an object with the properties trimmed', () => {})
// test('[4] the object returned is the exact same one we passed in', () => {})
})
describe('[Exercise 3] findLargestInteger', () => {
// test('[5] returns the largest number in an array of objects { integer: 2 }', () => {})
})
describe('[Exercise 4] Counter', () => {
let counter
beforeEach(() => {
counter = new utils.Counter(3) // each test must start with a fresh couter
})
// test('[6] the FIRST CALL of counter.countDown returns the initial count', () => {})
// test('[7] the SECOND CALL of counter.countDown returns the initial count minus one', () => {})
// test('[8] the count eventually reaches zero but does not go below zero', () => {})
})
describe('[Exercise 5] Seasons', () => {
let seasons
beforeEach(() => {
seasons = new utils.Seasons() // each test must start with fresh seasons
})
// test('[9] the FIRST call of seasons.next returns "summer"', () => {})
// test('[10] the SECOND call of seasons.next returns "fall"', () => {})
// test('[11] the THIRD call of seasons.next returns "winter"', () => {})
// test('[12] the FOURTH call of seasons.next returns "spring"', () => {})
// test('[13] the FIFTH call of seasons.next returns again "summer"', () => {})
// test('[14] the 40th call of seasons.next returns "spring"', () => {})
})
describe('[Exercise 6] Car', () => {
let focus
beforeEach(() => {
focus = new utils.Car('focus', 20, 30) // each test must start with a fresh car
})
// test('[15] driving the car returns the updated odometer', () => {})
// test('[16] driving the car uses gas', () => {})
// test('[17] refueling allows to keep driving', () => {})
// test('[18] adding fuel to a full tank has no effect', () => {})
})
describe('[Exercise 7] isEvenNumberAsync', () => {
// test('[19] resolves true if passed an even number', () => {})
// test('[20] resolves false if passed an odd number', () => {})
})