feat: support every widget in the demo dashboard (#6696)

This commit is contained in:
Thomas authored and GitHub committed 2026-08-26 08:44:55 +02:00
1 parent 40e34181e7
commit a56ec5d06a
42 files changed
+939 -163

No files matched your search

+15 -2
View File
@@ -7,6 +7,7 @@ import SuperJSON from "superjson";
import { expect, test } from "vitest";
import { DB_CASING } from "@homarr/core/infrastructure/db/constants";
import { widgetIntegrationSupport, widgetKinds } from "@homarr/definitions";
import type { Database } from "..";
import { seedDataAsync } from "../migrations/seed";
@@ -45,7 +46,7 @@ test("SQLite migrations seed the five disabled bundled custom widgets", async ()
connection.close();
});
test("SQLite migrations seed the redesigned demo dashboard", async () => {
test("SQLite migrations seed the complete demo widget gallery", async () => {
const previousDemoMode = process.env.DEMO_MODE;
process.env.DEMO_MODE = "true";
const connection = new BetterSqlite3(":memory:");
@@ -65,7 +66,7 @@ test("SQLite migrations seed the redesigned demo dashboard", async () => {
with: {
layouts: true,
sections: { with: { collapseStates: true, layouts: true } },
items: { with: { layouts: true } },
items: { with: { integrations: true, layouts: true } },
},
});
if (!board) throw new Error("Demo board was not seeded");
@@ -126,6 +127,18 @@ test("SQLite migrations seed the redesigned demo dashboard", async () => {
expectItemLayout("notifications", 3, 9, 2, 2);
expectItemLayout("beszelAlerts", 5, 9, 4, 2);
expect(new Set(board.items.map((item) => item.kind))).toEqual(new Set(widgetKinds));
const mockIntegration = await database.query.integrations.findFirst({
where: (table, { eq }) => eq(table.kind, "mock"),
});
if (!mockIntegration) throw new Error("Demo mock integration was not seeded");
for (const item of board.items) {
if (widgetIntegrationSupport[item.kind] === undefined) continue;
expect(item.integrations).toEqual([
expect.objectContaining({ integrationId: mockIntegration.id, itemId: item.id }),
]);
}
for (const kind of ["weather", "airQuality"]) {
const item = itemByKind(kind);
if (!item?.options) throw new Error(`Demo ${kind} options were not seeded`);