admin/lib/googleMapsNavigation.test.ts
alisaza e1eaf5eff5 feat: initial ghabilee-admin backoffice app
Extract admin dashboard from ghabilee-frontend2 into a dedicated Next.js
app for backoffice.ghabilee.ir (no SEO indexing / Clarity).
2026-09-05 13:12:59 +03:30

16 lines
676 B
TypeScript

import { describe, expect, it } from 'vitest'
import { getGoogleMapsDirectionsUrl, getGoogleMapsPlaceUrl } from '@/lib/googleMapsNavigation'
describe('googleMapsNavigation', () => {
it('builds a driving-directions URL with origin and destination coordinates', () => {
expect(getGoogleMapsDirectionsUrl({ lat: 35.7, lng: 51.4 }, { lat: 35.8, lng: 51.5 })).toBe(
'https://www.google.com/maps/dir/?api=1&origin=35.7%2C51.4&destination=35.8%2C51.5&travelmode=driving'
)
})
it('builds a destination fallback URL', () => {
expect(getGoogleMapsPlaceUrl({ lat: 35.7, lng: 51.4 })).toBe('https://www.google.com/maps/search/?api=1&query=35.7%2C51.4')
})
})