Fixing server test cases.

This commit is contained in:
mike12345567 2021-05-27 15:40:55 +01:00
parent 1470e601aa
commit 397a4d883f
5 changed files with 11 additions and 12 deletions

View File

@ -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", () => {

View File

@ -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(),
}))

View File

@ -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))

View File

@ -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) {

View File

@ -3,7 +3,7 @@ mockWorker()
function mockWorker() {
jest.mock("../../utilities/workerRequests", () => ({
getGlobalUsers: () => {
getGlobalSelf: () => {
return {
_id: "us_uuid1",
roles: {