mirror of
https://github.com/alexmickelson/canvasManagement.git
synced 2026-03-26 23:58:31 -06:00
holiday editing works
This commit is contained in:
29
nextjs/src/models/local/tests/testHolidayParsing.test.ts
Normal file
29
nextjs/src/models/local/tests/testHolidayParsing.test.ts
Normal 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"] });
|
||||
});
|
||||
});
|
||||
@@ -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")
|
||||
})
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user