fix(custom-widgets): restore bundled authoring

This commit is contained in:
Thomas Camlong committed 2026-07-20 16:48:00 +02:00
1 parent c39ddc4285
commit 4c69ad90df
16 files changed
+180 -58

No files matched your search

+27
View File
@@ -0,0 +1,27 @@
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 { DB_CASING } from "@homarr/core/infrastructure/db/constants";
import type { Database } from "..";
import { seedDataAsync } from "../migrations/seed";
import * as sqliteSchema from "../schema/sqlite";
test("SQLite migrations seed the four disabled bundled custom widgets", async () => {
const connection = new BetterSqlite3(":memory:");
const database = drizzle(connection, { schema: sqliteSchema, casing: DB_CASING });
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);
connection.close();
});