-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfizzbuzz.test.js
40 lines (33 loc) · 1.18 KB
/
fizzbuzz.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
const fizzbuzz = require('./fizzbuzz');
describe("fizzbuzz", () => {
test('should print ERROR message if they argument is not a number', () => {
const expected = 'Error: It is not a number';
const result = fizzbuzz("16");
expect(expected).toBe(result);
})
test("should print 1 if they receive 1", () => {
const expected = 1;
const result = fizzbuzz(1);
expect(expected).toBe(result);
});
test('should print fizz if they receive 3', () => {
const expected = 'fizz';
const result = fizzbuzz(3);
expect(expected).toBe(result);
})
test('should print fizz if they receive a multiple of 3', () => {
const expected = "fizz";
const result = fizzbuzz(6);
expect(expected).toBe(result);
})
test('should print buzz if they receive a multiple of 5', () => {
const expected = 'buzz';
const result = fizzbuzz(10);
expect(expected).toBe(result);
})
test('should print fizzbuzz if they receive a multiple of 3 and 5', () => {
const expected = 'fizzbuzz';
const result = fizzbuzz(15);
expect(expected).toBe(result);
})
});