import {expect,it} from 'vitest' import {emptyCost} from '@/views/archive/archive-model' import {costIssues,matchesPerson} from '@/views/archive/archive-cost-validation' it('zero amounts are valid and missing dates identify the exact section, row and input',()=>{ const form=emptyCost();form.income=0;form.labor=[{userId:2,name:'人员',duty:'研发',days:0,rate:0}];form.travel=[{userId:2,purpose:'出差',date:null,amount:0}];expect(costIssues(form)).toEqual([{key:'travel:0:date',label:'差旅费第 1 行:请选择出差日期'}]);form.travel[0].date='2026-10-26';expect(costIssues(form)).toEqual([]) }) it('admin is hidden by reserved ID or account while ordinary names are searched normally',()=>{ expect(matchesPerson({id:1,name:'任意姓名',account:'root'},'')).toBe(false);expect(matchesPerson({id:99,name:'管理员',account:'ADMIN'},'admin')).toBe(false);expect(matchesPerson({id:2,name:'王一',account:'wangyi'},'王')).toBe(true);expect(matchesPerson({id:2,name:'王一',account:'wangyi'},'li')).toBe(false);expect(matchesPerson({id:2,name:'管理员',account:'regular'},'')).toBe(true) })