-
Notifications
You must be signed in to change notification settings - Fork 0
/
functions.test.js
43 lines (37 loc) · 1.06 KB
/
functions.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
const { sum, subtract, multiply, addAllNumbers, factorial, findLetterInWord } = require('./functions');
describe('sum', () => {
test('adds 1 + 2 to equal 3', () => {
expect(sum(1, 2)).toBe(3);
});
// Add more tests for sum
});
describe('subtract', () => {
test('subtracts 2 - 1 to equal 1', () => {
expect(subtract(2, 1)).toBe(1);
});
// Add more tests for subtract
});
describe('multiply', () => {
test('multiplies 2 * 3 to equal 6', () => {
expect(multiply(2, 3)).toBe(6);
});
// Add more tests for multiply
});
describe('addAllNumbers', () => {
test('adds all numbers in [1, 2, 3] to equal 6', () => {
expect(addAllNumbers([1, 2, 3])).toBe(6);
});
// Add more tests for addAllNumbers
});
describe('factorial', () => {
test('factorial of 5 to equal 120', () => {
expect(factorial(5)).toBe(120);
});
// Add more tests for factorial
});
describe('findLetterInWord', () => {
test('finds letter "a" in word "apple"', () => {
expect(findLetterInWord('apple', 'a')).toBe(true);
});
// Add more tests for findLetterInWord
});