fix(migrate): guard report timestamp formatting · openclaw/openclaw@d2f69ec
steipete
·
2026-05-30
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
|
| 1 | +import path from "node:path"; |
| 2 | +import { describe, expect, it } from "vitest"; |
| 3 | +import { buildMigrationReportDir } from "./context.js"; |
| 4 | + |
| 5 | +describe("migration context helpers", () => { |
| 6 | +it("builds report directories with filename-safe timestamps", () => { |
| 7 | +const now = Date.parse("2026-02-23T12:34:56.000Z"); |
| 8 | +expect(buildMigrationReportDir("codex", "/state", now)).toBe( |
| 9 | +path.join("/state", "migration", "codex", "2026-02-23T12-34-56.000Z"), |
| 10 | +); |
| 11 | +}); |
| 12 | + |
| 13 | +it("falls back instead of throwing for out-of-range report timestamps", () => { |
| 14 | +expect(buildMigrationReportDir("codex", "/state", 9_000_000_000_000_000)).toMatch( |
| 15 | +/[/\\]migration[/\\]codex[/\\]\d{4}-\d{2}-\d{2}T\d{2}-\d{2}-\d{2}\.\d{3}Z$/, |
| 16 | +); |
| 17 | +}); |
| 18 | +}); |
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。