Add app migration test

This commit is contained in:
Adria Navarro 2023-12-11 10:47:53 +01:00
parent 99eb6597fb
commit 05b5692520
1 changed files with 14 additions and 1 deletions

View File

@ -1,8 +1,21 @@
import { context } from "@budibase/backend-core" import { context } from "@budibase/backend-core"
import * as setup from "../../api/routes/tests/utilities" import * as setup from "../../api/routes/tests/utilities"
import { MIGRATIONS } from "../migrations" 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". // 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 // 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 () => { it("each migration can rerun safely", async () => {