fix(custom-widgets): harden v2 authoring

This commit is contained in:
Thomas Camlong committed 2026-07-20 22:16:18 +02:00
1 parent ee832ad3c6
commit 7c66c912e7
171 files changed
+20311 -50527

No files matched your search

+3 -6
View File
@@ -2,13 +2,14 @@ import path from "path";
import BetterSqlite3 from "better-sqlite3";
import { drizzle } from "drizzle-orm/better-sqlite3";
import { migrate } from "drizzle-orm/better-sqlite3/migrator";
import { expect, test } from "vitest";
import { test } from "vitest";
import { DB_CASING } from "@homarr/core/infrastructure/db/constants";
import type { Database } from "..";
import { seedDataAsync } from "../migrations/seed";
import * as sqliteSchema from "../schema/sqlite";
import { expectBundledCustomWidgetsSeeded } from "./custom-widget-seed-assertions";
test("SQLite migrations seed the four disabled bundled custom widgets", async () => {
const connection = new BetterSqlite3(":memory:");
@@ -17,11 +18,7 @@ test("SQLite migrations seed the four disabled bundled custom widgets", async ()
migrate(database, { migrationsFolder: path.join(__dirname, "..", "migrations", "sqlite") });
await seedDataAsync(database as unknown as Database);
const bundledWidgets = await database.query.customWidgetDefinitions.findMany({
where: (table, { like }) => like(table.id, "seed-%"),
});
expect(bundledWidgets).toHaveLength(4);
expect(bundledWidgets.every(({ enabled }) => !enabled)).toBe(true);
await expectBundledCustomWidgetsSeeded(database as unknown as Database);
connection.close();
});