frontend/test/common/datetime/check_valid_date.test.ts

20 lines
585 B
TypeScript

import { assert, describe, it } from "vitest";
import checkValidDate from "../../../src/common/datetime/check_valid_date";
describe("checkValidDate", () => {
it("works", () => {
assert.strictEqual(checkValidDate(new Date()), true);
assert.strictEqual(
checkValidDate(new Date("2021-01-19T11:36:57+00:00")),
true
);
assert.strictEqual(
checkValidDate(new Date("2021-01-19X11:36:57+00:00")),
false
);
assert.strictEqual(checkValidDate(new Date("2021-01-19")), true);
assert.strictEqual(checkValidDate(undefined), false);
});
});