import { describe, expect, it } from 'vitest'; import { normalizeApiBase } from '@/lib/api'; describe('homepage API base URL', () => { it('keeps API URLs that already include the version prefix', () => { expect(normalizeApiBase('https://api.rentaldrivego.ma/api/v1')).toBe('https://api.rentaldrivego.ma/api/v1'); }); it('adds the version prefix when production env only contains the API host', () => { expect(normalizeApiBase('https://api.rentaldrivego.ma')).toBe('https://api.rentaldrivego.ma/api/v1'); }); it('normalizes trailing slashes before appending the version prefix', () => { expect(normalizeApiBase('https://api.rentaldrivego.ma/')).toBe('https://api.rentaldrivego.ma/api/v1'); }); });