mirror of
https://github.com/gethomepage/homepage.git
synced 2026-08-30 17:05:52 -07:00
Merge branch 'dev'
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import * as yaml from "js-yaml";
|
||||
|
||||
const EMPTY_DOCUMENT_ERROR = "expected a document, but the input is empty";
|
||||
const DEFAULT_SCHEMA = yaml.CORE_SCHEMA.withTags(yaml.timestampTag, yaml.mergeTag);
|
||||
const DEFAULT_SCHEMA = yaml.CORE_SCHEMA.withTags(yaml.timestampTag, yaml.mergeTag, yaml.legacyMapTag);
|
||||
|
||||
export function loadYaml(input, options) {
|
||||
try {
|
||||
|
||||
@@ -25,6 +25,16 @@ describe("utils/config/yaml", () => {
|
||||
});
|
||||
});
|
||||
|
||||
it("preserves v4 handling of non-string keys", () => {
|
||||
// an unsubstituted {{HOMEPAGE_VAR_*}} parses as a flow mapping key
|
||||
expect(loadYaml("- Plex:\n widget:\n key: {{HOMEPAGE_VAR_PLEX_KEY}}\n")).toEqual([
|
||||
{ Plex: { widget: { key: { "[object Object]": null } } } },
|
||||
]);
|
||||
expect(loadYaml("- Backups:\n - 2024-01-01:\n href: http://x\n")).toEqual([
|
||||
{ Backups: [{ [String(new Date("2024-01-01T00:00:00.000Z"))]: { href: "http://x" } }] },
|
||||
]);
|
||||
});
|
||||
|
||||
it("still rejects invalid YAML", () => {
|
||||
expect(() => loadYaml("value: [\n")).toThrow();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user