mirror of
https://github.com/gethomepage/homepage.git
synced 2026-09-27 06:21:18 -07:00
Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: shamoon <4887959+shamoon@users.noreply.github.com>
32 lines
1017 B
JavaScript
32 lines
1017 B
JavaScript
import { describe, expect, it } from "vitest";
|
|
|
|
import { loadYaml } from "./yaml";
|
|
|
|
describe("utils/config/yaml", () => {
|
|
it.each(["", " \n", "# comment only\n"])("loads an empty document from %j as undefined", (input) => {
|
|
expect(loadYaml(input)).toBeUndefined();
|
|
});
|
|
|
|
it("loads a populated document", () => {
|
|
expect(loadYaml("title: Homepage\n")).toEqual({ title: "Homepage" });
|
|
});
|
|
|
|
it("preserves v4 merge key behavior", () => {
|
|
expect(loadYaml("defaults: &defaults\n href: https://example.com\nservice:\n <<: *defaults\n")).toEqual({
|
|
defaults: { href: "https://example.com" },
|
|
service: { href: "https://example.com" },
|
|
});
|
|
});
|
|
|
|
it("preserves v4 timestamp behavior without enabling YAML 1.1 booleans", () => {
|
|
expect(loadYaml("date: 2026-08-21\nenabled: yes\n")).toEqual({
|
|
date: new Date("2026-08-21T00:00:00.000Z"),
|
|
enabled: "yes",
|
|
});
|
|
});
|
|
|
|
it("still rejects invalid YAML", () => {
|
|
expect(() => loadYaml("value: [\n")).toThrow();
|
|
});
|
|
});
|