import { describe, expect, it } from 'vitest' import { getNeshanDirectionsUrl, getNeshanPlaceUrl, hasMapCoordinates } from '@/lib/neshanNavigation' describe('neshanNavigation', () => { it('builds a driving-directions URL with origin and destination coordinates', () => { expect(getNeshanDirectionsUrl({ lat: 35.7, lng: 51.4 }, { lat: 35.8, lng: 51.5 })).toBe( 'https://nshn.ir/maps?origin=35.7%2C51.4&destination=35.8%2C51.5&type=drive' ) }) it('builds a destination fallback URL', () => { expect(getNeshanPlaceUrl({ lat: 35.7, lng: 51.4 })).toBe('https://nshn.ir/?lat=35.7&lng=51.4') }) it('accepts only valid latitude and longitude pairs', () => { expect(hasMapCoordinates(35.7, 51.4)).toBe(true) expect(hasMapCoordinates(91, 51.4)).toBe(false) expect(hasMapCoordinates(35.7, null)).toBe(false) }) })