2022-10-12 10:26:09 +05:30
|
|
|
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()
|
|
|
|
|
})
|
|
|
|
|
|
2023-02-07 08:50:28 -08:00
|
|
|
it('should return the mean absolute deviation of an array of numbers', () => {
|
2022-10-12 10:26:09 +05:30
|
|
|
const meanAbDev = meanAbsoluteDeviation([2, 34, 5, 0, -2])
|
|
|
|
|
expect(meanAbDev).toBe(10.479999999999999)
|
|
|
|
|
})
|
|
|
|
|
})
|