test(dayjs): relocate dayjs tests into commons

This commit is contained in:
Elian Doran
2025-12-03 20:54:35 +02:00
parent af2f6246e8
commit 94d015789d
2 changed files with 21 additions and 31 deletions

View File

@@ -1,5 +1,5 @@
import { LOCALES } from "./i18n.js";
import { DAYJS_LOADER } from "./dayjs.js";
import { DAYJS_LOADER, dayjs } from "./dayjs.js";
describe("dayjs", () => {
it("all dayjs locales are valid", async () => {
@@ -10,4 +10,22 @@ describe("dayjs", () => {
await dayjsLoader();
}
});
describe("Plugins", () => {
it("is-same-or-before is available", () => {
expect(dayjs("2023-10-01").isSameOrBefore(dayjs("2023-10-02"))).toBe(true);
});
it("is-same-or-after is available", () => {
expect(dayjs("2023-10-02").isSameOrAfter(dayjs("2023-10-01"))).toBe(true);
});
it("is-between is available", () => {
expect(dayjs("2023-10-02").isBetween(dayjs("2023-10-01"), dayjs("2023-10-03"))).toBe(true);
});
it("advanced format is available", () => {
expect(dayjs("2023-10-01").format("Q")).not.toBe("Q");
});
});
});