From 05b56925209eb4667276eb09c63dc9b7883bfe54 Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Mon, 11 Dec 2023 10:47:53 +0100 Subject: [PATCH] Add app migration test --- .../src/appMigrations/tests/migrations.spec.ts | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/packages/server/src/appMigrations/tests/migrations.spec.ts b/packages/server/src/appMigrations/tests/migrations.spec.ts index 9d80cc5f99..9b1a0a9dd8 100644 --- a/packages/server/src/appMigrations/tests/migrations.spec.ts +++ b/packages/server/src/appMigrations/tests/migrations.spec.ts @@ -1,8 +1,21 @@ import { context } from "@budibase/backend-core" import * as setup from "../../api/routes/tests/utilities" import { MIGRATIONS } from "../migrations" +import { getAppMigrationVersion } from "../appMigrationMetadata" +import { latestMigration } from ".." + +describe("migrations", () => { + it("new apps are created with the latest app migration version set", async () => { + const config = setup.getConfig() + await config.init() + + await config.doInContext(config.getAppId(), async () => { + const migrationVersion = await getAppMigrationVersion(config.getAppId()) + + expect(migrationVersion).toEqual(latestMigration) + }) + }) -describe("migration", () => { // These test is checking that each migration is "idempotent". // We should be able to rerun any migration, with any rerun not modifiying anything. The code should be aware that the migration already ran it("each migration can rerun safely", async () => {