1
0
Fork 0
mirror of synced 2024-07-03 21:40:55 +12:00

Fixing server test cases.

This commit is contained in:
mike12345567 2021-05-27 15:40:55 +01:00
parent 3d01ac17e9
commit c9a352bee7
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: {