bdd mocha test method

This commit is contained in:
2024-06-02 12:03:32 +02:00
parent 1662f15f21
commit b8e26c7703
2 changed files with 62 additions and 0 deletions

16
3.5mocha/test.js Normal file
View File

@@ -0,0 +1,16 @@
describe("pow", function(){
it("calculate the pow of the number", function(){
assert.equal(pow(2, 3), 8);
})
function maketest(x){
let expected = x * x * x;
it(`calculate ${x}^3`, function(){
assert.equal(pow(x, 3), expected);
})
}
for(let i = 1; i < 5; i++){
maketest(i);
}
});