Files
openclaw/src/shared/iso-time.test.ts
Wynne668 f104c51e85 fix(clawhub): reject calendar-invalid feed timestamps (#106942)
* fix(clawhub): reject calendar-invalid feed timestamps

* fix(clawhub): preserve strict feed timestamps

* fix(test): avoid promise executor return in clack prompter test

Co-authored-by: Cursor <cursoragent@cursor.com>

* fix(clawhub): preserve feed timestamp semantics

* fix(clawhub): strengthen feed timestamp validation

Co-authored-by: ZengWen-DT <ceng.wen@xydigit.com>

* fix(time): validate full end-of-day fractions

Co-authored-by: ZengWen-DT <ceng.wen@xydigit.com>

---------

Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Peter Steinberger <steipete@gmail.com>
2026-07-17 19:02:43 +01:00

28 lines
814 B
TypeScript

import { describe, expect, it } from "vitest";
import { hasValidIsoCalendarComponents } from "./iso-time.js";
describe("hasValidIsoCalendarComponents", () => {
it.each([
"2026-07-05",
"2028-02-29T12:30Z",
"2028-02-29T12:30:45.123456+01:30",
"2028-02-29T24:00:00Z",
"2028-02-29T24:00:00.0000Z",
])("accepts valid calendar components in %s", (value) => {
expect(hasValidIsoCalendarComponents(value)).toBe(true);
});
it.each([
"2026-02-29",
"2026-11-31T00:00:00Z",
"2026-00-10T00:00:00Z",
"2026-07-05T24:00:00.001Z",
"2026-07-05T24:00:00.0001Z",
"2026-07-05T12:60:00Z",
"2026-07-05T12:00:60Z",
"2026-7-05",
])("rejects invalid calendar components or shape in %s", (value) => {
expect(hasValidIsoCalendarComponents(value)).toBe(false);
});
});