javascript-exercises
javascript-exercises copied to clipboard
Unit test for 08_calculator power() function is too weak.
Only one test case for power() function is not enough,
expect(calculator.power(4,3)).toBe(64);
I add more unit tests:
- tests with negative base.
- tests for the negative exponent.
- if exponent equals 0, result should always be 1. 3.1. except for a base of 0, which should return 0.
- if base equals 0, 4.1. return Infinity if exponent is negative. 4.2. otherwise, always return 0.
Here is my pull request: #223 08_calculator: add some unit test. And to keep solutions up to date, watch this pull request: #226 Keep calculator solution up to date