diff --git a/README.md b/README.md index 1e741a3..c842a65 100644 --- a/README.md +++ b/README.md @@ -32,9 +32,9 @@ That's actually a good question. I guess that discovery does not happen with a s # How to run? -from console, install jest +from console, install with npm: ``` -npm install --save-dev jest +npm install ``` then you can just run the tests @@ -45,4 +45,4 @@ npm test if you want to benchmark use ``` npm run bench -``` \ No newline at end of file +``` diff --git a/javascript/The73Calculator.js b/javascript/The73Calculator.js index 2fa89c6..893dd29 100644 --- a/javascript/The73Calculator.js +++ b/javascript/The73Calculator.js @@ -77,6 +77,12 @@ module.exports = class The73Calculator { return n; } - static noop(n) {} + static octal(n) { + let numberAsOctal = (n + 4).toString(8) + numberAsOctal = parseInt(numberAsOctal) % 10 + + return numberAsOctal; + } + static noop(n) {} }; \ No newline at end of file diff --git a/javascript/The73Calculator.test.js b/javascript/The73Calculator.test.js index 58ba8ce..3b62099 100644 --- a/javascript/The73Calculator.test.js +++ b/javascript/The73Calculator.test.js @@ -53,14 +53,12 @@ describe("The73Calculator", () => { test(The73Calculator.usingPolynom.name, () => { expectBehavior(The73Calculator.usingPolynom); }); - - - + test(The73Calculator.octal.name, () => { + expectBehavior(The73Calculator.octal); + }); function expectBehavior(f) { expect(f(3)).toBe(7); expect(f(7)).toBe(3); } - - }); \ No newline at end of file