Files
JavaScript/Maths/test/MeanAbsoluteDeviation.test.js
Lioness100 002b10a5aa docs: fix typos (#1283)
* docs: fix typos

* fix
2023-02-07 22:20:28 +05:30

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)
})
})