1
0
Fork 0
mirror of synced 2024-06-02 02:25:17 +12:00

API Screens - Fetch screens test

Additional test to fetch screens.
- To confirm the screen was created i am checking `routes`
- It will then confirm the route with the screen exists - in this case the route is `/test` (as determined when the screen is created)
This commit is contained in:
Mitch-Budibase 2022-10-10 17:27:55 +01:00
parent 18b9f65161
commit 44c9ef1568
2 changed files with 22 additions and 0 deletions

View file

@ -46,4 +46,10 @@ export default class AppApi {
const json = await response.json()
return [response, json.data]
}
async getRoutes(): Promise<[Response, any]> {
const response = await this.api.get(`/routing`)
const json = await response.json()
return [response, json]
}
}

View file

@ -30,7 +30,23 @@ describe("Internal API - /screens endpoints", () => {
const [response, screen] = await config.screen.createScreen(generateScreen())
expect(response).toHaveStatusCode(200)
expect(screen.routing.roleId).toEqual("BASIC")
})
it("GET - Fetch screens", async () => {
// Create app
const [appResponse, app] = await appConfig.applications.create(generateApp())
expect(appResponse).toHaveStatusCode(200)
expect(app._id).toBeDefined()
// Create Screen
appConfig.applications.api.appId = app.appId
const [response, screen] = await config.screen.createScreen(generateScreen())
expect(response).toHaveStatusCode(200)
// Check screen exists
const [routesResponse, routes] = await appConfig.applications.getRoutes()
expect(routesResponse).toHaveStatusCode(200)
expect(routes.routes["/test"]).toBeTruthy()
})
it("DELETE - Delete a screen", async () => {