mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 09:50:42 +00:00
test: fix ui presenter next run test for multi-language environments (#60231)
Merged via squash.
Prepared head SHA: 88e7c3c95b
Co-authored-by: medns <1575008+medns@users.noreply.github.com>
Co-authored-by: odysseus0 <8635094+odysseus0@users.noreply.github.com>
Reviewed-by: @odysseus0
This commit is contained in:
@@ -1,16 +1,18 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { t } from "../ui/src/i18n/index.ts";
|
||||
import { formatNextRun } from "../ui/src/ui/presenter.ts";
|
||||
|
||||
describe("formatNextRun", () => {
|
||||
it("returns n/a for nullish values", () => {
|
||||
expect(formatNextRun(null)).toBe("n/a");
|
||||
expect(formatNextRun(undefined)).toBe("n/a");
|
||||
it("returns localized n/a for nullish values", () => {
|
||||
expect(formatNextRun(null)).toBe(t("common.na"));
|
||||
expect(formatNextRun(undefined)).toBe(t("common.na"));
|
||||
});
|
||||
|
||||
it("includes weekday and relative time", () => {
|
||||
const ts = Date.UTC(2026, 1, 23, 15, 0, 0);
|
||||
const out = formatNextRun(ts);
|
||||
expect(out).toMatch(/^[A-Za-z]{3}, /);
|
||||
const weekday = new Date(ts).toLocaleDateString(undefined, { weekday: "short" });
|
||||
expect(out.slice(0, weekday.length + 2)).toBe(`${weekday}, `);
|
||||
expect(out).toContain("(");
|
||||
expect(out).toContain(")");
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user