gongxiangp2/lib/__tests__/performance-survey-target-policy.test.ts

28 lines
1.0 KiB
TypeScript

import { getPerformanceSurveyTargetEmployeeIds } from '@/lib/performance-survey-target-policy'
describe('performance survey target policy', () => {
test('人员考核默认使用当前账户', () => {
expect(getPerformanceSurveyTargetEmployeeIds({
requestedEmployeeIds: [],
currentEmployeeId: 'employee-current',
surveyKind: 'person_period',
})).toEqual(['employee-current'])
})
test('添加其他被考核人时保留当前账户并去重', () => {
expect(getPerformanceSurveyTargetEmployeeIds({
requestedEmployeeIds: ['employee-other', 'employee-current', 'employee-other'],
currentEmployeeId: 'employee-current',
surveyKind: 'visual_case',
})).toEqual(['employee-current', 'employee-other'])
})
test('事项型调研不自动注入当前账户', () => {
expect(getPerformanceSurveyTargetEmployeeIds({
requestedEmployeeIds: ['employee-other'],
currentEmployeeId: 'employee-current',
surveyKind: 'item_course',
})).toEqual(['employee-other'])
})
})