Skip to content

Commit 41b4eb3

Browse files
committed
add tests for initial math funcs, reorders tests
1 parent 63f2c3e commit 41b4eb3

File tree

1 file changed

+38
-17
lines changed

1 file changed

+38
-17
lines changed

test/index-test.js

Lines changed: 38 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -5,29 +5,50 @@ beforeEach(function() {
55
b = Math.floor(Math.random() * 1000)
66
})
77

8-
it('add(a, b) adds two numbers and returns the result', function() {
9-
expect(add(a, b)).toEqual(a + b)
10-
})
8+
describe('basic math functions', function () {
9+
it("'add()' is a valid function", function() {
10+
expect(add).toExist
11+
})
1112

12-
it('subtract(a, b) subtracts b from a and returns the result', function() {
13-
expect(subtract(a, b)).toEqual(a - b)
14-
})
13+
it("'subtract()' is a valid function", function() {
14+
expect(add).toExist
15+
})
1516

16-
it('multiply(a, b) multiplies two numbers and returns the result', function() {
17-
expect(multiply(a, b)).toEqual(a * b)
18-
})
17+
it("'multiple()' is a valid function", function() {
18+
expect(add).toExist
19+
})
1920

20-
it('divide(a, b) divides a by b and returns the result', function() {
21-
expect(divide(a, b)).toEqual(a / b)
22-
})
21+
it("'divide()' is a valid function", function() {
22+
expect(add).toExist
23+
})
2324

24-
it('inc(n) increments n and returns the result', function() {
25-
expect(inc(a)).toEqual(a + 1)
25+
it('add(a, b) adds two numbers and returns the result', function() {
26+
expect(add(a, b)).toEqual(a + b)
27+
})
28+
29+
it('subtract(a, b) subtracts b from a and returns the result', function() {
30+
expect(subtract(a, b)).toEqual(a - b)
31+
})
32+
33+
it('multiply(a, b) multiplies two numbers and returns the result', function() {
34+
expect(multiply(a, b)).toEqual(a * b)
35+
})
36+
37+
it('divide(a, b) divides a by b and returns the result', function() {
38+
expect(divide(a, b)).toEqual(a / b)
39+
})
40+
41+
it('increment(n) increments n and returns the result', function() {
42+
expect(increment(a)).toEqual(a + 1)
43+
})
44+
45+
it('decrement(n) decrements n and returns the result', function() {
46+
expect(decrement(a)).toEqual(a - 1)
47+
})
2648
})
2749

28-
it('dec(n) decrements n and returns the result', function() {
29-
expect(dec(a)).toEqual(a - 1)
30-
})
50+
51+
3152

3253
describe('makeInt(n)', function() {
3354
it('parses n as an integer and returns the parsed integer', function() {

0 commit comments

Comments
 (0)