From b8e26c770384bf799ec1c38b5c22d00c0d1e4013 Mon Sep 17 00:00:00 2001 From: mhrooz Date: Sun, 2 Jun 2024 12:03:32 +0200 Subject: [PATCH] bdd mocha test method --- 3.5mocha/index.html | 46 +++++++++++++++++++++++++++++++++++++++++++++ 3.5mocha/test.js | 16 ++++++++++++++++ 2 files changed, 62 insertions(+) create mode 100644 3.5mocha/index.html create mode 100644 3.5mocha/test.js diff --git a/3.5mocha/index.html b/3.5mocha/index.html new file mode 100644 index 0000000..adac1dd --- /dev/null +++ b/3.5mocha/index.html @@ -0,0 +1,46 @@ + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + \ No newline at end of file diff --git a/3.5mocha/test.js b/3.5mocha/test.js new file mode 100644 index 0000000..a52aa46 --- /dev/null +++ b/3.5mocha/test.js @@ -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); + } +}); \ No newline at end of file