feat(版本详情): 接入计划时间与日期选择
This commit is contained in:
33
apps/web/lib/dev-task-transitions.test.ts
Normal file
33
apps/web/lib/dev-task-transitions.test.ts
Normal file
@@ -0,0 +1,33 @@
|
||||
import test from 'node:test';
|
||||
import assert from 'node:assert/strict';
|
||||
|
||||
import type { DevTask } from './dev-task';
|
||||
import { needsDelayReason } from './dev-task-transitions';
|
||||
|
||||
function task(patch: Partial<DevTask> = {}): DevTask {
|
||||
return {
|
||||
id: 'task-1',
|
||||
taskNo: 'DEV-001',
|
||||
requirementId: 'req-1',
|
||||
title: '实现排班规则',
|
||||
categoryId: 'cat-frontend-interaction',
|
||||
assigneeId: 'Alice',
|
||||
priority: 'P2',
|
||||
expectedStartAt: '2026-06-29T01:00:00.000Z',
|
||||
expectedEndAt: '2026-06-29T10:00:00.000Z',
|
||||
status: 'todo',
|
||||
isBlocked: false,
|
||||
createdBy: 'PM',
|
||||
createdAt: '2026-06-29T00:00:00.000Z',
|
||||
updatedAt: '2026-06-29T00:00:00.000Z',
|
||||
...patch,
|
||||
};
|
||||
}
|
||||
|
||||
test('needsDelayReason does not require a reason before expected end time', () => {
|
||||
assert.equal(needsDelayReason(task(), new Date('2026-06-29T09:00:00.000Z')), false);
|
||||
});
|
||||
|
||||
test('needsDelayReason requires a reason after expected end time for todo tasks', () => {
|
||||
assert.equal(needsDelayReason(task(), new Date('2026-06-29T10:01:00.000Z')), true);
|
||||
});
|
||||
Reference in New Issue
Block a user