import { buildNavigationLinks } from '../../utils/navigation-links';
import { Station } from '../../types/stations.types';

const baseStation: Station = {
  placeId: 'place-123',
  name: 'Test Station',
  address: '123 Main St, City',
  latitude: 37.7749,
  longitude: -122.4194,
  rating: 4.2
};

describe('buildNavigationLinks', () => {
  it('uses coordinates when valid', () => {
    const links = buildNavigationLinks(baseStation);

    expect(links.google).toContain('destination=37.7749,-122.4194');
    expect(links.google).toContain('destination_place_id=place-123');
    expect(links.apple).toContain('daddr=37.7749,-122.4194');
    expect(links.waze).toContain('ll=37.7749,-122.4194');
  });

  it('falls back to query when coordinates are missing', () => {
    const links = buildNavigationLinks({
      ...baseStation,
      latitude: 0,
      longitude: 0
    });

    expect(links.google).toContain('query=');
    expect(links.apple).toContain('q=');
    expect(links.waze).toContain('q=');
  });
});
