mirror of
https://github.com/TheAlgorithms/JavaScript.git
synced 2025-12-19 06:58:15 +08:00
Update AverageMedian.js and added AverageMedian.test.js
This commit is contained in:
21
Maths/test/AverageMedian.test.js
Normal file
21
Maths/test/AverageMedian.test.js
Normal file
@@ -0,0 +1,21 @@
|
||||
import { averageMedian } from '../AverageMedian'
|
||||
|
||||
test('should return the median of an array of numbers:', () => {
|
||||
const medianValue = averageMedian([1, 2, 6, 4, 5])
|
||||
expect(medianValue).toBe(4)
|
||||
})
|
||||
|
||||
test('should return the median of an array of numbers:', () => {
|
||||
const medianValue = averageMedian([8, 9, 1, 2, 5, 10, 11])
|
||||
expect(medianValue).toBe(8)
|
||||
})
|
||||
|
||||
test('should return the median of an array of numbers:', () => {
|
||||
const medianValue = averageMedian([15, 18, 3, 9, 13, 5])
|
||||
expect(medianValue).toBe(11)
|
||||
})
|
||||
|
||||
test('should return the median of an array of numbers:', () => {
|
||||
const medianValue = averageMedian([1,2,3,4,6,8])
|
||||
expect(medianValue).toBe(3.5)
|
||||
})
|
||||
Reference in New Issue
Block a user