-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathadd.test.js
27 lines (26 loc) · 918 Bytes
/
add.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
// assert docs: https://nodejs.org/api/assert.html#assert_assert
const assert = require('assert');
const { add } = require('../../src/add');
describe('SUBTASKS 1.1', function () {
it(':1 should add one number', function () {
const result = add(1) === 1;
const message = 'Should accept a single param';
assert.ok(result, message);
const result2 = add(42) === 42;
assert.ok(result2, message);
});
it(':2 should add two numbers', function () {
const result = add(1, 2) === 3;
const message = 'Should accept two params';
assert.ok(result, message);
const result2 = add(42, 4) === 46;
assert.ok(result2, message);
});
it(':3 should add three numbers', function () {
const result = add(1, 2, 3) === 6;
const message = 'Should accept three params';
assert.ok(result, message);
const result2 = add(42, 4, 4) === 50;
assert.ok(result2, message);
});
});