import { describe, expect, it } from 'vitest';
import { selectAllExamIds, toggleExamSelection } from './selection';

describe('考试批量选择', () => {
  it('可以选择和取消单场考试且不会重复选择', () => {
    expect(toggleExamSelection([1], 2, true)).toEqual([1, 2]);
    expect(toggleExamSelection([1, 2], 2, true)).toEqual([1, 2]);
    expect(toggleExamSelection([1, 2], 1, false)).toEqual([2]);
  });

  it('全选只包含当前结果并去重，取消全选后清空', () => {
    expect(selectAllExamIds([1, 2, 2, 3], true)).toEqual([1, 2, 3]);
    expect(selectAllExamIds([1, 2, 3], false)).toEqual([]);
  });
});
