import { describe, expect, it } from 'vitest';
import { intentToOnboardingPath, normalizeIntent } from './auth-intent';

describe('normalizeIntent', () => {
  it('normalizes all supported intent aliases', () => {
    expect(normalizeIntent('customer')).toBe('customer');
    expect(normalizeIntent('professional')).toBe('professional');
    expect(normalizeIntent('pro')).toBe('professional');
    expect(normalizeIntent('company')).toBe('company');
    expect(normalizeIntent('employer')).toBe('company');
    expect(normalizeIntent('job_seeker')).toBe('job_seeker');
    expect(normalizeIntent('job-seeker')).toBe('job_seeker');
    expect(normalizeIntent('jobseeker')).toBe('job_seeker');
  });

  it('returns null for unknown values', () => {
    expect(normalizeIntent('unknown')).toBeNull();
    expect(normalizeIntent('')).toBeNull();
    expect(normalizeIntent(null)).toBeNull();
    expect(normalizeIntent(undefined)).toBeNull();
  });
});

describe('intentToOnboardingPath', () => {
  it('maps each intent to signup route with intent query', () => {
    expect(intentToOnboardingPath('company')).toBe('/signup?intent=company');
    expect(intentToOnboardingPath('job_seeker')).toBe('/signup?intent=job_seeker');
    expect(intentToOnboardingPath('professional')).toBe('/signup?intent=professional');
    expect(intentToOnboardingPath('customer')).toBe('/signup?intent=customer');
  });
});
