You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

41 lines
801 B
JavaScript

'use strict';
const assert = require('assert');
const { sum } = require('./sum');
class SumTestSuite {
testSumCorrectness() {
const a = 1;
const b = 2;
const result = sum(a, b);
assert(result === a + b, 'the result should be the sum of its arguments');
}
testSumNoArgs() {
try {
sum();
} catch {
return;
}
assert.fail('should fail if not provided any arguments');
}
testSumMissingArg() {
const a = 1;
try {
sum(a);
} catch {
return;
}
assert.fail('should fail if not provided all arguments');
}
testWillFail() {
assert.fail('I have failed!');
}
}
module.exports = {
SumTestSuite,
}