mirror of
https://github.com/TheAlgorithms/JavaScript.git
synced 2025-07-04 07:29:47 +08:00

* algorithm: add SquareRootLogarithmic algo and a test for it * fix: fix spelling errors * refactor: rename a variable "e" --> "edge"
14 lines
492 B
JavaScript
14 lines
492 B
JavaScript
import { squareRootLogarithmic } from '../SquareRootLogarithmic'
|
|
|
|
describe('SquareRootLogarithmic', () => {
|
|
test('Finding the square root of a positive integer', () => {
|
|
expect(squareRootLogarithmic(4)).toEqual(2)
|
|
expect(squareRootLogarithmic(16)).toEqual(4)
|
|
expect(squareRootLogarithmic(8)).toEqual(2)
|
|
})
|
|
test('Throwing an exception', () => {
|
|
expect(() => squareRootLogarithmic('not a number')).toThrow()
|
|
expect(() => squareRootLogarithmic(true)).toThrow()
|
|
})
|
|
})
|