import { describe, expect, it, vi } from 'vitest';

const { mockCreateNavigation } = vi.hoisted(() => ({
  mockCreateNavigation: vi.fn(() => ({
    Link: 'MockLink',
    redirect: 'mockRedirect',
    usePathname: 'mockUsePathname',
    useRouter: 'mockUseRouter',
  })),
}));

// Mock routing config
vi.mock('../routing', () => ({
  routing: {
    locales: ['vi', 'en'] as const,
    defaultLocale: 'vi',
    localePrefix: 'as-needed',
  },
}));

vi.mock('next-intl/navigation', () => ({
  createNavigation: mockCreateNavigation,
}));

import { Link, redirect, usePathname, useRouter } from '../navigation';

describe('i18n/navigation', () => {
  it('calls createNavigation with the routing config', () => {
    expect(mockCreateNavigation).toHaveBeenCalledWith({
      locales: ['vi', 'en'],
      defaultLocale: 'vi',
      localePrefix: 'as-needed',
    });
  });

  it('exports Link from createNavigation', () => {
    expect(Link).toBeDefined();
  });

  it('exports redirect from createNavigation', () => {
    expect(redirect).toBeDefined();
  });

  it('exports usePathname from createNavigation', () => {
    expect(usePathname).toBeDefined();
  });

  it('exports useRouter from createNavigation', () => {
    expect(useRouter).toBeDefined();
  });
});
