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