mirror of
https://github.com/TheAlgorithms/JavaScript.git
synced 2025-07-07 02:05:08 +08:00
12 lines
413 B
JavaScript
12 lines
413 B
JavaScript
import { haversineDistance } from '../Haversine'
|
|
|
|
describe('Testing the haversine distance calculator', () => {
|
|
it('Calculate distance', () => {
|
|
const distance = haversineDistance(64.1265, -21.8174, 40.7128, -74.0060)
|
|
expect(distance).toBe(4208198.758424171)
|
|
})
|
|
it('Test validation, expect throw', () => {
|
|
expect(() => haversineDistance(64.1265, -21.8174, 40.7128, '74.0060')).toThrow()
|
|
})
|
|
})
|