1
0
Fork 0
mirror of synced 2024-10-03 02:27:06 +13:00

Add app migration test

This commit is contained in:
Adria Navarro 2023-12-11 10:47:53 +01:00
parent 99eb6597fb
commit 05b5692520

View file

@ -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 () => {