Extra typings

This commit is contained in:
Adria Navarro 2023-01-20 11:48:11 +00:00
parent 62b372ce59
commit 27171e7680
5 changed files with 31 additions and 25 deletions

View File

@ -4,7 +4,7 @@ import { AppStatus } from "../../../db/utils"
import * as setup from "./utilities" import * as setup from "./utilities"
describe("/cloud", () => { describe("/cloud", () => {
let request = setup.getRequest() let request = setup.getRequest()!
let config = setup.getConfig() let config = setup.getConfig()
afterAll(setup.afterAll) afterAll(setup.afterAll)
@ -25,7 +25,7 @@ describe("/cloud", () => {
await request await request
.post( .post(
`/api/applications/${dbCore.getProdAppID( `/api/applications/${dbCore.getProdAppID(
config.getAppId() config.getAppId()!
)}/unpublish` )}/unpublish`
) )
.set(config.defaultHeaders()) .set(config.defaultHeaders())

View File

@ -46,7 +46,7 @@ export function delay(ms: number) {
} }
let request: supertest.SuperTest<supertest.Test> | undefined | null, let request: supertest.SuperTest<supertest.Test> | undefined | null,
config: TestConfig config: TestConfig | null
export function beforeAll() { export function beforeAll() {
config = new TestConfig() config = new TestConfig()
@ -60,6 +60,7 @@ export function afterAll() {
// clear app files // clear app files
request = null request = null
config = null
} }
export function getRequest() { export function getRequest() {

View File

@ -15,11 +15,12 @@ import {
} from "@budibase/types" } from "@budibase/types"
import _ from "lodash" import _ from "lodash"
const config = setup.getConfig() const config = setup.getConfig()!
jest.unmock("node-fetch") jest.unmock("node-fetch")
describe("row api - postgres", () => { // TODO: Waiting for the test image to exist
describe.skip("row api - postgres", () => {
let apiKey, let apiKey,
makeRequest: MakeRequestResponse, makeRequest: MakeRequestResponse,
postgresDatasource: Datasource, postgresDatasource: Datasource,
@ -30,6 +31,7 @@ describe("row api - postgres", () => {
await config.init() await config.init()
apiKey = await config.generateApiKey() apiKey = await config.generateApiKey()
postgresDatasource = await config.createDatasource({ postgresDatasource = await config.createDatasource({
datasource: {
type: "datasource", type: "datasource",
source: SourceName.POSTGRES, source: SourceName.POSTGRES,
plus: true, plus: true,
@ -44,6 +46,7 @@ describe("row api - postgres", () => {
rejectUnauthorized: false, rejectUnauthorized: false,
ca: false, ca: false,
}, },
},
}) })
makeRequest = generateMakeRequest(apiKey, true) makeRequest = generateMakeRequest(apiKey, true)

View File

@ -145,12 +145,14 @@ class TestConfiguration {
if (this.allApps) { if (this.allApps) {
cleanup(this.allApps.map(app => app.appId)) cleanup(this.allApps.map(app => app.appId))
if (env.isDockerisedTest()) {
await this._req( await this._req(
null, null,
{ appId: this.prodApp.appId }, { appId: this.prodApp.appId },
controllers.app.destroy controllers.app.destroy
) )
} }
}
if (this.server) { if (this.server) {
this.server.close() this.server.close()
@ -300,7 +302,7 @@ class TestConfiguration {
}) })
} }
defaultHeaders(extras = {}, isInternal: boolean) { defaultHeaders(extras = {}, isInternal: boolean = false) {
const authObj = { const authObj = {
userId: GLOBAL_USER_ID, userId: GLOBAL_USER_ID,
sessionId: "sessionid", sessionId: "sessionid",

View File

@ -8,7 +8,7 @@ export interface Datasource extends Document {
source: SourceName source: SourceName
// the config is defined by the schema // the config is defined by the schema
config?: { config?: {
[key: string]: string | number | boolean [key: string]: string | number | boolean | any[]
} }
plus?: boolean plus?: boolean
entities?: { entities?: {