holiday editing works

This commit is contained in:
2024-10-29 14:13:30 -06:00
parent 590a245536
commit b4daeb52b0
6 changed files with 201 additions and 51 deletions

View File

@@ -0,0 +1,29 @@
import { describe, it, expect } from "vitest";
import { parseHolidays } from "../settingsUtils";
describe("can parse holiday string", () => {
it("can parse empty list", () => {
const testString = `
springBreak:
`;
const output = parseHolidays(testString);
expect(output).toEqual({ springBreak: [] });
});
it("can parse list with date", () => {
const testString = `
springBreak:
- 10/12/2024
`;
const output = parseHolidays(testString);
expect(output).toEqual({ springBreak: ["10/12/2024"] });
});
it("can parse list with two dates", () => {
const testString = `
springBreak:
- 10/12/2024
- 10/13/2024
`;
const output = parseHolidays(testString);
expect(output).toEqual({ springBreak: ["10/12/2024", "10/13/2024"] });
});
});

View File

@@ -61,4 +61,12 @@ describe("Can properly handle expected date formats", () => {
expect(updatedString).toBe("08/29/2024 17:00:00")
})
it("can handle date without time", () => {
const dateString = "8/29/2024";
const dateObject = getDateFromString(dateString);
expect(dateObject).not.toBeUndefined()
const updatedString = dateToMarkdownString(dateObject!)
expect(updatedString).toBe("08/29/2024 00:00:00")
})
});