Skip to content

修复 workbench.test 时间炸弹:硬编码时间戳改相对时间 - #21

Merged
todosdev[bot] merged 1 commit into
mainfrom
tds/conv-01a1ee3e-2801-7a35-9b67-06f5a70ead38
Nov 18, 2026
Merged

todosdev[bot] merged 1 commit into
mainfrom
tds/conv-01a1ee3e-2801-7a35-9b67-06f5a70ead38

Conversation

@todosdev

@todosdev todosdev Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • 将 workbench.test.tsx 中的硬编码时间戳改为基于运行时刻的相对时间生成函数。
  • 解决文件剩余时间跌破 24 小时阈值导致分享默认档位自动降为 1h 引起的断言失效,彻底消除测试时间炸弹。

Changes

  • web/src/pages/workbench.test.tsx:
    • 引入 futureIso(hours) 与 pastIso(hours) 相对时间辅助函数。
    • 将 mock 数据中文件与分享的 expiresAt 设置为当前时间后 48 小时,确保剩余时间恒大于 24 小时,分享默认档位稳定断言为 "24h"。
    • 将 createdAt 与 lastDownloadedAt 替换为相对过去的时刻,全文件清除所有硬编码 ISO 时间戳。

Testing

  • pnpm --filter ./web test src/pages/workbench.test.tsx:7 项测试全部通过。
  • pnpm test:Worker(237 项)与 Web(156 项)共 393 项测试全量通过。
  • pnpm lint / pnpm format:check / pnpm typecheck / pnpm build:全部校验通过。
  • 分支 CI(run 44292099816)已通过验证并全绿。

@todosdev
todosdev Bot merged commit 73acedf into main Nov 18, 2026
2 checks passed
@mapxn
mapxn deleted the tds/conv-01a1ee3e-2801-7a35-9b67-06f5a70ead38 branch November 19, 2026 09:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant