阶段十:完成注释门禁最终验收
This commit is contained in:
1 parent
d1a165f897
commit
f30a1f68f8
29 files changed
+509
-7253
No files matched your search
@@ -2,7 +2,7 @@ import { describe, expect, test } from 'vitest';
|
||||
import { getDateRange, getPreviousDateRange } from './dateRange';
|
||||
|
||||
describe('date ranges', () => {
|
||||
const now = new Date('2026-07-10T12:00:00');
|
||||
const now = new Date('2026-07-10T12:00:00'); /* now 表示now。 */
|
||||
|
||||
test.each([
|
||||
['3days', '2026-07-08'],
|
||||
@@ -10,21 +10,21 @@ describe('date ranges', () => {
|
||||
['30days', '2026-06-11'],
|
||||
] as const)('%s includes exactly the requested number of days', (range, startDate) => {
|
||||
expect(getDateRange(range, now)).toEqual({ startDate, endDate: '2026-07-10' });
|
||||
});
|
||||
} /* 回调函数负责当前业务流程。 */);
|
||||
|
||||
test('previous range has the same length without overlap', () => {
|
||||
const current = getDateRange('7days', now);
|
||||
const current = getDateRange('7days', now); /* current 表示current。 */
|
||||
expect(getPreviousDateRange(current)).toEqual({ startDate: '2026-06-27', endDate: '2026-07-03' });
|
||||
});
|
||||
} /* 回调函数负责当前业务流程。 */);
|
||||
|
||||
test('works across year boundaries', () => {
|
||||
expect(getDateRange('3days', new Date('2026-01-01T12:00:00'))).toEqual({
|
||||
startDate: '2025-12-30',
|
||||
endDate: '2026-01-01',
|
||||
});
|
||||
});
|
||||
} /* 回调函数负责当前业务流程。 */);
|
||||
|
||||
test('rejects reversed custom dates', () => {
|
||||
expect(() => getDateRange('custom', now, '2026-07-11', '2026-07-10')).toThrow('开始日期不能晚于结束日期');
|
||||
});
|
||||
});
|
||||
expect(() => getDateRange('custom', now, '2026-07-11', '2026-07-10') /* 回调函数负责当前业务流程。 */).toThrow('开始日期不能晚于结束日期');
|
||||
} /* 回调函数负责当前业务流程。 */);
|
||||
} /* 回调函数负责当前业务流程。 */);
|
||||
Reference in new issue
Block a user