mirror of
https://github.com/zadam/trilium.git
synced 2025-12-03 22:14:24 +01:00
test(dayjs): add a test for all plugins
This commit is contained in:
parent
94d015789d
commit
2d73627908
@ -12,6 +12,19 @@ describe("dayjs", () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
describe("Plugins", () => {
|
describe("Plugins", () => {
|
||||||
|
it("advanced format is available", () => {
|
||||||
|
expect(dayjs("2023-10-01").format("Q")).not.toBe("Q");
|
||||||
|
});
|
||||||
|
|
||||||
|
it("is-between is available", () => {
|
||||||
|
expect(dayjs("2023-10-02").isBetween(dayjs("2023-10-01"), dayjs("2023-10-03"))).toBe(true);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("iso-week is available", () => {
|
||||||
|
// ISO week number: 2023-01-01 is ISO week 52 of previous year
|
||||||
|
expect(dayjs("2023-01-01").isoWeek()).toBe(52);
|
||||||
|
});
|
||||||
|
|
||||||
it("is-same-or-before is available", () => {
|
it("is-same-or-before is available", () => {
|
||||||
expect(dayjs("2023-10-01").isSameOrBefore(dayjs("2023-10-02"))).toBe(true);
|
expect(dayjs("2023-10-01").isSameOrBefore(dayjs("2023-10-02"))).toBe(true);
|
||||||
});
|
});
|
||||||
@ -20,12 +33,13 @@ describe("dayjs", () => {
|
|||||||
expect(dayjs("2023-10-02").isSameOrAfter(dayjs("2023-10-01"))).toBe(true);
|
expect(dayjs("2023-10-02").isSameOrAfter(dayjs("2023-10-01"))).toBe(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("is-between is available", () => {
|
it("quarter-year is available", () => {
|
||||||
expect(dayjs("2023-10-02").isBetween(dayjs("2023-10-01"), dayjs("2023-10-03"))).toBe(true);
|
expect(dayjs("2023-05-15").quarter()).toBe(2);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("advanced format is available", () => {
|
it("utc is available", () => {
|
||||||
expect(dayjs("2023-10-01").format("Q")).not.toBe("Q");
|
const utcDate = dayjs("2023-10-01T12:00:00").utc();
|
||||||
|
expect(utcDate.utcOffset()).toBe(0);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user