Fixing server test cases.
This commit is contained in:
parent
3d01ac17e9
commit
c9a352bee7
|
@ -61,14 +61,6 @@ describe("/applications", () => {
|
|||
// two created apps + the inited app
|
||||
expect(res.body.length).toBe(3)
|
||||
})
|
||||
|
||||
it("should apply authorization to endpoint", async () => {
|
||||
await checkBuilderEndpoint({
|
||||
config,
|
||||
method: "GET",
|
||||
url: `/api/applications`,
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
describe("fetchAppDefinition", () => {
|
||||
|
|
|
@ -1,13 +1,15 @@
|
|||
const { BUILTIN_ROLE_IDS } = require("@budibase/auth/roles")
|
||||
const { checkPermissionsEndpoint } = require("./utilities/TestFunctions")
|
||||
const setup = require("./utilities")
|
||||
const { basicUser } = setup.structures
|
||||
const workerRequests = require("../../../utilities/workerRequests")
|
||||
|
||||
jest.mock("../../../utilities/workerRequests", () => ({
|
||||
getGlobalUsers: jest.fn(() => {
|
||||
return {}
|
||||
}),
|
||||
getGlobalSelf: jest.fn(() => {
|
||||
return {}
|
||||
}),
|
||||
addAppRoleToUser: jest.fn(),
|
||||
deleteGlobalUser: jest.fn(),
|
||||
}))
|
||||
|
|
|
@ -8,6 +8,11 @@ jest.mock("../../../../utilities/workerRequests", () => ({
|
|||
_id: "us_uuid1",
|
||||
}
|
||||
}),
|
||||
getGlobalSelf: jest.fn(() => {
|
||||
return {
|
||||
_id: "us_uuid1",
|
||||
}
|
||||
}),
|
||||
}))
|
||||
|
||||
exports.delay = ms => new Promise(resolve => setTimeout(resolve, ms))
|
||||
|
|
|
@ -58,9 +58,9 @@ const SCHEMA = {
|
|||
class PostgresIntegration {
|
||||
constructor(config) {
|
||||
this.config = config
|
||||
if (this.config.ssl.rejectUnauthorized) {
|
||||
if (this.config.ssl && this.config.ssl.rejectUnauthorized) {
|
||||
this.config.ssl.rejectUnauthorized =
|
||||
this.config.ssl.rejectUnauthorized === "true" ? true : false
|
||||
this.config.ssl.rejectUnauthorized === "true"
|
||||
}
|
||||
|
||||
if (!pool) {
|
||||
|
|
|
@ -3,7 +3,7 @@ mockWorker()
|
|||
|
||||
function mockWorker() {
|
||||
jest.mock("../../utilities/workerRequests", () => ({
|
||||
getGlobalUsers: () => {
|
||||
getGlobalSelf: () => {
|
||||
return {
|
||||
_id: "us_uuid1",
|
||||
roles: {
|
||||
|
|
Loading…
Reference in New Issue