Add test for migration disabling.

This commit is contained in:
mike12345567 2024-06-05 17:09:46 +01:00
parent 80ddadbe06
commit 3cf3588192
1 changed files with 11 additions and 0 deletions

View File

@ -1,6 +1,7 @@
import { Header } from "@budibase/backend-core"
import * as setup from "../../api/routes/tests/utilities"
import * as migrations from "../migrations"
import { migrationsEnabled } from "../index"
import { getAppMigrationVersion } from "../appMigrationMetadata"
jest.mock<typeof migrations>("../migrations", () => ({
@ -52,4 +53,14 @@ describe("migrations", () => {
},
})
})
it("should disable migrations if any migration is disabled", () => {
migrations.MIGRATIONS.push({
id: "20231211105814_new-test",
func: async () => {},
disabled: true,
})
expect(migrationsEnabled()).toBe(false)
})
})