Remove pro mock and invert if condition on backups enabled
This commit is contained in:
parent
a25cc7fbaf
commit
d746c42503
|
@ -108,7 +108,7 @@ async function deployApp(deployment: any, userId: string) {
|
||||||
const productionAppId = getProdAppID(appId)
|
const productionAppId = getProdAppID(appId)
|
||||||
|
|
||||||
// don't try this if feature isn't allowed, will error
|
// don't try this if feature isn't allowed, will error
|
||||||
if (!(await backups.isEnabled())) {
|
if (await backups.isEnabled()) {
|
||||||
// trigger backup initially
|
// trigger backup initially
|
||||||
await backups.triggerAppBackup(
|
await backups.triggerAppBackup(
|
||||||
productionAppId,
|
productionAppId,
|
||||||
|
|
|
@ -1,14 +1,5 @@
|
||||||
const triggerAppBackupMock = jest.fn()
|
|
||||||
jest.mock("@budibase/pro", () => ({
|
|
||||||
...jest.requireActual("@budibase/pro"),
|
|
||||||
backups: {
|
|
||||||
triggerAppBackup: triggerAppBackupMock,
|
|
||||||
addAppBackupProcessors: jest.fn(),
|
|
||||||
},
|
|
||||||
}))
|
|
||||||
import setup from "./utilities"
|
import setup from "./utilities"
|
||||||
import { events } from "@budibase/backend-core"
|
import { events } from "@budibase/backend-core"
|
||||||
import { AppBackupTrigger } from "@budibase/types"
|
|
||||||
|
|
||||||
describe("/deployments", () => {
|
describe("/deployments", () => {
|
||||||
let request = setup.getRequest()
|
let request = setup.getRequest()
|
||||||
|
@ -28,12 +19,6 @@ describe("/deployments", () => {
|
||||||
.set(config.defaultHeaders())
|
.set(config.defaultHeaders())
|
||||||
.expect("Content-Type", /json/)
|
.expect("Content-Type", /json/)
|
||||||
.expect(200)
|
.expect(200)
|
||||||
expect(triggerAppBackupMock).toBeCalledTimes(1)
|
|
||||||
expect(triggerAppBackupMock).toBeCalledWith(
|
|
||||||
config.prodAppId,
|
|
||||||
AppBackupTrigger.PUBLISH,
|
|
||||||
{ createdBy: config.userMetadataId }
|
|
||||||
)
|
|
||||||
expect((events.app.published as jest.Mock).mock.calls.length).toBe(1)
|
expect((events.app.published as jest.Mock).mock.calls.length).toBe(1)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in New Issue