import { describe, expect, it } from 'vitest';
import { getHelpSlugForPathname } from '../helpRouting';

describe('getHelpSlugForPathname', () => {
  it('returns a getting-started slug for home paths', () => {
    expect(getHelpSlugForPathname('/')).toBe('getting-started');
    expect(getHelpSlugForPathname('/e/demo')).toBe('getting-started');
  });

  it('returns null for help pages', () => {
    expect(getHelpSlugForPathname('/help')).toBeNull();
    expect(getHelpSlugForPathname('/help/gallery-and-sharing')).toBeNull();
    expect(getHelpSlugForPathname('/e/demo/help/gallery-and-sharing')).toBeNull();
  });

  it('maps gallery related pages', () => {
    expect(getHelpSlugForPathname('/e/demo/gallery')).toBe('gallery-and-sharing');
    expect(getHelpSlugForPathname('/e/demo/photo/123')).toBe('gallery-and-sharing');
    expect(getHelpSlugForPathname('/e/demo/slideshow')).toBe('gallery-and-sharing');
  });

  it('maps upload related pages', () => {
    expect(getHelpSlugForPathname('/e/demo/upload')).toBe('uploading-photos');
    expect(getHelpSlugForPathname('/e/demo/queue')).toBe('upload-troubleshooting');
  });

  it('maps tasks and achievements', () => {
    expect(getHelpSlugForPathname('/e/demo/tasks')).toBe('tasks-and-missions');
    expect(getHelpSlugForPathname('/e/demo/tasks/12')).toBe('tasks-and-missions');
    expect(getHelpSlugForPathname('/e/demo/achievements')).toBe('achievements-and-badges');
  });
});
