Files
JavaScript/Maths/test/QuadraticRoots.test.js
Dibya12345 f271a2cae0 Added QuadraticRoots to Math/QuadraticRoots.js (#1376)
* Added QuadraticRoots in the Math/QuadraticRoots

* Fixed math/QyadraticRoots var to let

* Added relevant links math/QyadraticRoots

* Added relevant links math/QyadraticRoots and fixed let - const

* Added the changes and @see notation in Math/QuadraticRoots.js

* Added the changes Math/QuadraticRoots.js and return an empty []

* Readd describe block, remove redundant comments

* Changed [1,1] to [1]

---------

Co-authored-by: Dibya <Dibya.DebayanDash@siriuscom.com>
Co-authored-by: Lars Müller <34514239+appgurueu@users.noreply.github.com>
2023-10-02 12:42:39 +05:30

14 lines
527 B
JavaScript

import { quadraticRoots } from '../QuadraticRoots.js'
describe('quadratic roots', () => {
it('returns an array with two real roots when the discriminant is positive', () => {
expect(quadraticRoots(1, -3, 2)).toEqual([2, 1])
})
it('returns an array with one real root when the discriminant is zero', () => {
expect(quadraticRoots(1, -2, 1)).toEqual([1])
})
it('returns an empty array indicating no real roots when the discriminant is negative', () => {
expect(quadraticRoots(1, 2, 5)).toEqual([])
})
})