Remove pro mock and invert if condition on backups enabled

This commit is contained in:
Rory Powell 2022-10-24 14:23:16 +01:00
parent a25cc7fbaf
commit d746c42503
2 changed files with 1 additions and 16 deletions

View File

@ -108,7 +108,7 @@ async function deployApp(deployment: any, userId: string) {
const productionAppId = getProdAppID(appId)
// don't try this if feature isn't allowed, will error
if (!(await backups.isEnabled())) {
if (await backups.isEnabled()) {
// trigger backup initially
await backups.triggerAppBackup(
productionAppId,

View File

@ -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 { events } from "@budibase/backend-core"
import { AppBackupTrigger } from "@budibase/types"
describe("/deployments", () => {
let request = setup.getRequest()
@ -28,12 +19,6 @@ describe("/deployments", () => {
.set(config.defaultHeaders())
.expect("Content-Type", /json/)
.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)
})
})