Files
JavaScript/Maths/test/PerfectCube.test.js
Ricardo Fernández Serrata 979046897d merge: Edit Perfect{Square, Cube} (#1071)
* Make `PerfectCube` more correct and readable

* Add negative and Infinity tests

* Fixed comment formatting

* Realized BigInt support is unnecessary

The algorithm would be exactly the same, so there's no added educational value

* Update PerfectCube.js

* Remove space

* Update PerfectCube.js

Now `isInt` is replaced by `isFinite`, because `isInt` is a redundant check

* Update PerfectCube.js

Remove dot

* Parity between `PerfectSquare` and `PerfectCube`

* Update PerfectSquare.test.js

Fixed the old copy-paste error that said "cube" instead of "square". And added `Infinity` test
2022-08-12 23:14:25 +05:30

13 lines
376 B
JavaScript

import { perfectCube } from '../PerfectCube'
describe('PerfectCube', () => {
it('should return true for a perfect cube', () => {
expect(perfectCube(125)).toBeTruthy()
expect(perfectCube(-125)).toBeTruthy()
})
it('should return false for a non perfect cube', () => {
expect(perfectCube(100)).toBeFalsy()
expect(perfectCube(Infinity)).toBeFalsy()
})
})