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.

33 lines
678 B
JavaScript

import { strict as assert } from "assert"
import { sum } from "./sum.js"
export function testSumResult() {
const a = 1
const b = 2
const result = sum(a, b)
assert(result === a + b, "the result should be the sum of its arguments")
}
export function testSumNoArgs() {
try {
sum()
} catch (_) {
return
}
assert.fail("should fail if not provided any arguments")
}
export function testSumMissingArg() {
const a = 1
try {
sum(a)
} catch (_) {
return
}
assert.fail("should fail if not provided all arguments")
}
export function testWillFail() {
assert.fail("I have failed!")
}