Merge pull request #6767 from Budibase/fix/user-email-view-migration

fixing broken migration and single image
This commit is contained in:
Martin McKeaveney 2022-07-18 10:43:27 +01:00 committed by GitHub
commit af682709df
2 changed files with 9 additions and 9 deletions

View File

@ -4,15 +4,13 @@ const { getGlobalDB, doInTenant } = require("@budibase/backend-core/tenancy")
// mock email view creation // mock email view creation
const coreDb = require("@budibase/backend-core/db") const coreDb = require("@budibase/backend-core/db")
const createUserEmailView = jest.fn() const createNewUserEmailView = jest.fn()
coreDb.createUserEmailView = createUserEmailView coreDb.createNewUserEmailView = createNewUserEmailView
const migration = require("../userEmailViewCasing") const migration = require("../userEmailViewCasing")
describe("run", () => { describe("run", () => {
doInTenant(TENANT_ID, () => {
let config = new TestConfig(false) let config = new TestConfig(false)
const globalDb = getGlobalDB()
beforeEach(async () => { beforeEach(async () => {
await config.init() await config.init()
@ -21,8 +19,10 @@ describe("run", () => {
afterAll(config.end) afterAll(config.end)
it("runs successfully", async () => { it("runs successfully", async () => {
await migration.run(globalDb) await doInTenant(TENANT_ID, async () => {
expect(createUserEmailView).toHaveBeenCalledTimes(1) const globalDb = getGlobalDB()
await migration.run(globalDb)
expect(createNewUserEmailView).toHaveBeenCalledTimes(1)
})
}) })
})
}) })

View File

@ -1,4 +1,4 @@
const { createUserEmailView } = require("@budibase/backend-core/db") const { createNewUserEmailView } = require("@budibase/backend-core/db")
/** /**
* Date: * Date:
@ -9,5 +9,5 @@ const { createUserEmailView } = require("@budibase/backend-core/db")
*/ */
export const run = async (db: any) => { export const run = async (db: any) => {
await createUserEmailView(db) await createNewUserEmailView(db)
} }