mirror of
https://github.com/TheAlgorithms/JavaScript.git
synced 2025-07-04 07:29:47 +08:00
17 lines
541 B
JavaScript
17 lines
541 B
JavaScript
import { meanAbsoluteDeviation } from '../MeanAbsoluteDeviation.js'
|
|
|
|
describe('tests for mean absolute deviation', () => {
|
|
it('should be a function', () => {
|
|
expect(typeof meanAbsoluteDeviation).toEqual('function')
|
|
})
|
|
|
|
it('should throw an invalid input error', () => {
|
|
expect(() => meanAbsoluteDeviation('fgh')).toThrow()
|
|
})
|
|
|
|
it('should return the mean absolute deviation of an array of numbers', () => {
|
|
const meanAbDev = meanAbsoluteDeviation([2, 34, 5, 0, -2])
|
|
expect(meanAbDev).toBe(10.479999999999999)
|
|
})
|
|
})
|