1
0
Fork 0
mirror of synced 2024-06-23 08:30:31 +12:00

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 4d0f5f22ac
commit 20dffc0a07
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)
})
})