diff --git a/packages/server/src/api/routes/public/tests/utils.ts b/packages/server/src/api/routes/public/tests/utils.ts index 35770aaab5..8e7c6e187c 100644 --- a/packages/server/src/api/routes/public/tests/utils.ts +++ b/packages/server/src/api/routes/public/tests/utils.ts @@ -1,20 +1,24 @@ +import * as setup from "../../tests/utilities" import { checkSlashesInUrl } from "../../../../utilities" +import supertest from "supertest" + +export type HttpMethod = "post" | "get" export type MakeRequestResponse = ( - method: string, + method: HttpMethod, endpoint: string, body?: any, intAppId?: string -) => Promise +) => Promise -export function generateMakeRequest(apiKey: string, setup: any) { - const request = setup.getRequest() +export function generateMakeRequest(apiKey: string): MakeRequestResponse { + const request = setup.getRequest()! const config = setup.getConfig() return async ( - method: string, + method: HttpMethod, endpoint: string, body?: any, - intAppId: string = config.getAppId() + intAppId: string | null = config.getAppId() ) => { const extraHeaders: any = { "x-budibase-api-key": apiKey, diff --git a/packages/server/src/api/routes/tests/utilities/index.ts b/packages/server/src/api/routes/tests/utilities/index.ts index 2786d2ba12..0997474e5a 100644 --- a/packages/server/src/api/routes/tests/utilities/index.ts +++ b/packages/server/src/api/routes/tests/utilities/index.ts @@ -1,5 +1,6 @@ import TestConfig from "../../../../tests/utilities/TestConfiguration" import env from "../../../../environment" +import supertest from "supertest" export * as structures from "../../../../tests/utilities/structures" function user() { @@ -44,7 +45,8 @@ export function delay(ms: number) { return new Promise(resolve => setTimeout(resolve, ms)) } -let request: any, config: TestConfig +let request: supertest.SuperTest | undefined | null, + config: TestConfig export function beforeAll() { config = new TestConfig()