1
0
Fork 0
mirror of synced 2024-06-26 18:10:51 +12:00
budibase/qa-core/src/config/internal-api/TestConfiguration/screens.ts
Mitch-Budibase 25f9a2043b Small changes based on PR feedback
As per some of the comments on the PR:
- Renaming createScreen & deleteScreen to create & delete as they are on the screens namespace
- Updating a test within create.spec.js (applications) for when a screen is generated
- Improvements to the current screens tests (removing unnecessary `expect` lines & updating the for loop for the create screens test)
2022-10-12 17:48:33 +01:00

24 lines
719 B
TypeScript

import { Screen } from "@budibase/types"
import { Response } from "node-fetch"
import InternalAPIClient from "./InternalAPIClient"
export default class ScreenApi {
api: InternalAPIClient
constructor(apiClient: InternalAPIClient) {
this.api = apiClient
}
async create(body: any): Promise<[Response, Screen]> {
const response = await this.api.post(`/screens`, { body })
const json = await response.json()
return [response, json]
}
async delete(screenId: string, rev: string): Promise<[Response, Screen]> {
const response = await this.api.del(`/screens/${screenId}/${rev}`)
const json = await response.json()
return [response, json]
}
}