Type tests utils
This commit is contained in:
parent
70168a20fa
commit
6412da730c
|
@ -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<any>
|
||||
) => Promise<supertest.Response>
|
||||
|
||||
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,
|
||||
|
|
|
@ -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<supertest.Test> | undefined | null,
|
||||
config: TestConfig
|
||||
|
||||
export function beforeAll() {
|
||||
config = new TestConfig()
|
||||
|
|
Loading…
Reference in New Issue