fix(custom-widgets): harden v2 authoring
This commit is contained in:
171 files changed
+20311
-50527
No files matched your search
@@ -3,13 +3,14 @@ import { PostgreSqlContainer } from "@testcontainers/postgresql";
|
||||
import { drizzle } from "drizzle-orm/node-postgres";
|
||||
import { migrate } from "drizzle-orm/node-postgres/migrator";
|
||||
import { Pool } from "pg";
|
||||
import { describe, expect, test } from "vitest";
|
||||
import { describe, test } from "vitest";
|
||||
|
||||
import { DB_CASING } from "@homarr/core/infrastructure/db/constants";
|
||||
|
||||
import * as pgSchema from "../schema/postgresql";
|
||||
import type { Database } from "..";
|
||||
import { seedDataAsync } from "../migrations/seed";
|
||||
import { expectBundledCustomWidgetsSeeded } from "./custom-widget-seed-assertions";
|
||||
|
||||
describe("PostgreSql Migration", () => {
|
||||
test("should add all tables and keys specified in migration files", async () => {
|
||||
@@ -42,11 +43,7 @@ describe("PostgreSql Migration", () => {
|
||||
|
||||
// Check if users table exists
|
||||
await database.query.users.findMany();
|
||||
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);
|
||||
|
||||
// Close the pool to release resources
|
||||
await pool.end();
|
||||
|
||||
Reference in new issue
Block a user