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:
parent
d52c9a5cfb
commit
6aa0d41eb2
|
@ -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]
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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 () => {
|
||||
|
|
Loading…
Reference in New Issue