en.javascript.info/1-js/03-code-quality/05-testing-mocha/pow-4.view/test.js
2018-12-10 10:26:29 -03:00

19 lines
399 B
JavaScript

describe("pow", function() {
describe("raises x to power 3", function() {
function makeTest(x) {
let expected = x * x * x;
it(`${x} in the power 3 is ${expected}`, function() {
assert.equal(pow(x, 3), expected);
});
}
for (let x = 1; x <= 5; x++) {
makeTest(x);
}
});
// ... more tests to follow here, both describe and it can be added
});