import { describe, expect, it } from 'vitest';
import { getTabKey, getTransitionKind, isTransitionDisabled } from '../RouteTransition';

describe('RouteTransition helpers', () => {
  it('detects top-level tabs', () => {
    expect(getTabKey('/e/demo')).toBe('home');
    expect(getTabKey('/e/demo/tasks')).toBe('tasks');
    expect(getTabKey('/e/demo/achievements')).toBe('achievements');
    expect(getTabKey('/e/demo/gallery')).toBe('gallery');
    expect(getTabKey('/e/demo/tasks/123')).toBeNull();
  });

  it('detects tab vs stack transitions', () => {
    expect(getTransitionKind('/e/demo', '/e/demo/gallery')).toBe('tab');
    expect(getTransitionKind('/e/demo/tasks', '/e/demo/tasks/1')).toBe('stack');
  });

  it('disables transitions for excluded routes', () => {
    expect(isTransitionDisabled('/e/demo/upload')).toBe(true);
    expect(isTransitionDisabled('/share/demo-photo')).toBe(true);
    expect(isTransitionDisabled('/e/demo/gallery')).toBe(false);
  });
});
