import { describe, expect, it } from 'vitest';
import { shouldNavigateTodoCard } from './DashboardTodoCards';

describe('DashboardTodoCards 点击导航守卫', () => {
  it('目标路径与当前路径不同且冷却已过时允许导航', () => {
    expect(shouldNavigateTodoCard('/dashboard', '/attendance', 1000, 1600)).toBe(true);
  });

  it('目标路径与当前路径相同时不允许导航', () => {
    expect(shouldNavigateTodoCard('/attendance', '/attendance', 1000, 1600)).toBe(false);
  });

  it('冷却期内忽略重复点击，防止产生多条历史记录', () => {
    expect(shouldNavigateTodoCard('/dashboard', '/attendance', 1000, 1300)).toBe(false);
  });
});
