fix: 修复测试套件质量审查问题——act环境、正则匹配、mock排序、超时设置
This commit is contained in:
@@ -24,32 +24,10 @@ describe("getDateGroup", () => {
|
||||
});
|
||||
|
||||
test("本周内的日期返回 thisWeek", () => {
|
||||
const now = new Date();
|
||||
const dayOfWeek = now.getDay();
|
||||
const mondayOffset = dayOfWeek === 0 ? 6 : dayOfWeek - 1;
|
||||
const wednesday = new Date(now);
|
||||
wednesday.setDate(now.getDate() - (dayOfWeek === 0 ? 6 : dayOfWeek - 1) + 2);
|
||||
if (wednesday > now) {
|
||||
const tuesday = new Date(now);
|
||||
tuesday.setDate(now.getDate() - mondayOffset + 1);
|
||||
if (tuesday < now && tuesday.getDate() !== now.getDate() - 1) {
|
||||
const result = getDateGroup(tuesday.toISOString(), now);
|
||||
expect(result).toBe("thisWeek");
|
||||
return;
|
||||
}
|
||||
}
|
||||
const tuesday = new Date(now);
|
||||
tuesday.setDate(now.getDate() - mondayOffset + 1);
|
||||
if (tuesday.toDateString() !== now.toDateString()) {
|
||||
const yesterday = new Date(now);
|
||||
yesterday.setDate(yesterday.getDate() - 1);
|
||||
if (tuesday.toDateString() !== yesterday.toDateString()) {
|
||||
const result = getDateGroup(tuesday.toISOString(), now);
|
||||
expect(result).toBe("thisWeek");
|
||||
return;
|
||||
}
|
||||
}
|
||||
expect(true).toBe(true);
|
||||
const now = new Date(2026, 5, 10);
|
||||
const monday = new Date(2026, 5, 8);
|
||||
const result = getDateGroup(monday.toISOString(), now);
|
||||
expect(result).toBe("thisWeek");
|
||||
});
|
||||
|
||||
test("本月内的日期返回 thisMonth", () => {
|
||||
|
||||
Reference in New Issue
Block a user