1
0
Fork 0
mirror of synced 2024-06-02 10:34:40 +12:00
budibase/qa-core/src/tests/public-api/TestConfiguration.ts
2022-09-05 18:28:53 +01:00

40 lines
814 B
TypeScript

import PublicAPIClient from "./PublicAPIClient";
import generateApp from "./applications/fixtures/generate"
class TestConfiguration {
testContext: Record<string, any>;
apiClient: PublicAPIClient;
constructor() {
this.testContext = {}
this.apiClient = new PublicAPIClient()
}
async beforeAll() {
}
async afterAll() {
}
async seedTable(appId: string) {
const response = await this.apiClient.post("/tables", {
body: require("./tables/fixtures/seed.json"),
headers: {
"x-budibase-app-id": appId
}
})
const json = await response.json()
return json.data
}
async seedApp() {
const response = await this.apiClient.post("/applications", {
body: generateApp()
})
return response.json()
}
}
export default TestConfiguration