mirror of
https://github.com/gethomepage/homepage.git
synced 2026-09-28 15:01:17 -07:00
add tests covering layout
This commit is contained in:
@@ -524,6 +524,38 @@ describe("utils/config/service-helpers", () => {
|
|||||||
]);
|
]);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("cleanServiceGroups keeps feed layout and drops server-side options", async () => {
|
||||||
|
const mod = await import("./service-helpers");
|
||||||
|
const { cleanServiceGroups } = mod;
|
||||||
|
|
||||||
|
const rawGroups = [
|
||||||
|
{
|
||||||
|
name: "Core",
|
||||||
|
services: [
|
||||||
|
{
|
||||||
|
name: "News",
|
||||||
|
widgets: [
|
||||||
|
{
|
||||||
|
type: "feed",
|
||||||
|
url: "https://example.com/feed.xml?token=secret",
|
||||||
|
maxItems: 3,
|
||||||
|
images: false,
|
||||||
|
layout: "grid",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
groups: [],
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
const feedWidget = cleanServiceGroups(rawGroups)[0].services[0].widgets[0];
|
||||||
|
expect(feedWidget).toEqual(expect.objectContaining({ type: "feed", layout: "grid" }));
|
||||||
|
expect(feedWidget).not.toHaveProperty("url");
|
||||||
|
expect(feedWidget).not.toHaveProperty("maxItems");
|
||||||
|
expect(feedWidget).not.toHaveProperty("images");
|
||||||
|
});
|
||||||
|
|
||||||
it("findGroupByName deep-searches and annotates parent", async () => {
|
it("findGroupByName deep-searches and annotates parent", async () => {
|
||||||
const mod = await import("./service-helpers");
|
const mod = await import("./service-helpers");
|
||||||
const { findGroupByName } = mod;
|
const { findGroupByName } = mod;
|
||||||
|
|||||||
Reference in New Issue
Block a user