ensure correct revert endpoint being hit, update call to revert
This commit is contained in:
parent
f633ffb824
commit
052bc0aeed
|
@ -103,7 +103,7 @@ exports.revert = async ctx => {
|
|||
target: appId,
|
||||
})
|
||||
try {
|
||||
if (!env.isCypress()) {
|
||||
if (env.COUCH_DB_URL) {
|
||||
// in-memory db stalls on rollback
|
||||
await replication.rollback()
|
||||
}
|
||||
|
|
|
@ -18,6 +18,7 @@ import { Table } from "@budibase/types"
|
|||
import { quotas } from "@budibase/pro"
|
||||
import { isEqual } from "lodash"
|
||||
import { cloneDeep } from "lodash/fp"
|
||||
import env from "../../../environment"
|
||||
|
||||
function checkAutoColumns(table: Table, oldTable: Table) {
|
||||
if (!table.schema) {
|
||||
|
@ -167,7 +168,7 @@ export async function destroy(ctx: any) {
|
|||
await db.remove(tableToDelete)
|
||||
|
||||
// remove table search index
|
||||
if (!isTest()) {
|
||||
if (!isTest() || env.COUCH_DB_URL) {
|
||||
const currentIndexes = await db.getIndexes()
|
||||
const existingIndex = currentIndexes.indexes.find(
|
||||
(existing: any) => existing.name === `search:${ctx.params.tableId}`
|
||||
|
|
|
@ -59,8 +59,8 @@ export default class AppApi {
|
|||
return [response, json]
|
||||
}
|
||||
|
||||
async revert(appId: string): Promise<[Response, Application]> {
|
||||
const response = await this.api.post(`/applications/${appId}/client/revert`)
|
||||
async revert(appId: string): Promise<[Response, { message: string }]> {
|
||||
const response = await this.api.post(`/dev/${appId}/revert`)
|
||||
const json = await response.json()
|
||||
return [response, json]
|
||||
}
|
||||
|
@ -82,8 +82,8 @@ export default class AppApi {
|
|||
const json = await response.json()
|
||||
return [response, json]
|
||||
}
|
||||
async addScreentoApp(body: any): Promise<[Response, Application]> {
|
||||
|
||||
async addScreentoApp(body: any): Promise<[Response, Application]> {
|
||||
const response = await this.api.post(`/screens`, { body })
|
||||
const json = await response.json()
|
||||
return [response, json]
|
||||
|
|
|
@ -158,11 +158,11 @@ describe("Internal API - /applications endpoints", () => {
|
|||
expect(screenResponse).toHaveStatusCode(200)
|
||||
expect(screen._id).toBeDefined()
|
||||
|
||||
|
||||
const [revertResponse, revert] = await config.applications.revert(app.appId ? app.appId : "")
|
||||
// // Revert the app to published state
|
||||
const [revertResponse, revert] = await config.applications.revert(app.appId as string)
|
||||
expect(revertResponse).toHaveStatusCode(200)
|
||||
expect(revert).toEqual({
|
||||
message: "App reverted successfully."
|
||||
message: "Reverted changes successfully."
|
||||
})
|
||||
|
||||
// Check screen is removed
|
||||
|
|
Loading…
Reference in New Issue