Test fixes
This commit is contained in:
parent
0f29b0cb03
commit
50e2d3c686
|
@ -2,6 +2,7 @@ import * as rowController from "../../../controllers/row"
|
||||||
import * as appController from "../../../controllers/application"
|
import * as appController from "../../../controllers/application"
|
||||||
import { AppStatus } from "../../../../db/utils"
|
import { AppStatus } from "../../../../db/utils"
|
||||||
import { BUILTIN_ROLE_IDS } from "@budibase/backend-core/roles"
|
import { BUILTIN_ROLE_IDS } from "@budibase/backend-core/roles"
|
||||||
|
import { doInTenant } from "@budibase/backend-core/tenancy"
|
||||||
import { TENANT_ID } from "../../../../tests/utilities/structures"
|
import { TENANT_ID } from "../../../../tests/utilities/structures"
|
||||||
import { getAppDB, doInAppContext } from "@budibase/backend-core/context"
|
import { getAppDB, doInAppContext } from "@budibase/backend-core/context"
|
||||||
import * as env from "../../../../environment"
|
import * as env from "../../../../environment"
|
||||||
|
@ -32,17 +33,19 @@ export const getAllTableRows = async (config: any) => {
|
||||||
}
|
}
|
||||||
|
|
||||||
export const clearAllApps = async (tenantId = TENANT_ID) => {
|
export const clearAllApps = async (tenantId = TENANT_ID) => {
|
||||||
const req: any = { query: { status: AppStatus.DEV }, user: { tenantId } }
|
await doInTenant(tenantId, async () => {
|
||||||
await appController.fetch(req)
|
const req: any = { query: { status: AppStatus.DEV }, user: { tenantId } }
|
||||||
const apps = req.body
|
await appController.fetch(req)
|
||||||
if (!apps || apps.length <= 0) {
|
const apps = req.body
|
||||||
return
|
if (!apps || apps.length <= 0) {
|
||||||
}
|
return
|
||||||
for (let app of apps) {
|
}
|
||||||
const { appId } = app
|
for (let app of apps) {
|
||||||
const req = new Request(null, { appId })
|
const { appId } = app
|
||||||
await runRequest(appId, appController.destroy, req)
|
const req = new Request(null, { appId })
|
||||||
}
|
await runRequest(appId, appController.destroy, req)
|
||||||
|
}
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
export const clearAllAutomations = async (config: any) => {
|
export const clearAllAutomations = async (config: any) => {
|
||||||
|
|
Loading…
Reference in New Issue