API Screens - Updating create screen test
The create screen tests will now create a screen with each available role type - The types are: BASIC, POWER, ADMIN, PUBLIC
This commit is contained in:
parent
6aa0d41eb2
commit
b301adbd88
|
@ -2,7 +2,7 @@ import generator from "../../generator"
|
||||||
|
|
||||||
const randomId = generator.guid()
|
const randomId = generator.guid()
|
||||||
|
|
||||||
const generateScreen = (): any => ({
|
const generateScreen = (roleId: string): any => ({
|
||||||
showNavigation: true,
|
showNavigation: true,
|
||||||
width: "Large",
|
width: "Large",
|
||||||
name: randomId,
|
name: randomId,
|
||||||
|
@ -26,7 +26,7 @@ const generateScreen = (): any => ({
|
||||||
gap: "M"
|
gap: "M"
|
||||||
}, routing: {
|
}, routing: {
|
||||||
route: "/test",
|
route: "/test",
|
||||||
roleId: "BASIC",
|
roleId: roleId,
|
||||||
homeScreen: false
|
homeScreen: false
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
|
@ -19,17 +19,20 @@ describe("Internal API - /screens endpoints", () => {
|
||||||
await config.afterAll()
|
await config.afterAll()
|
||||||
})
|
})
|
||||||
|
|
||||||
it("POST - Create a BASIC screen", async () => {
|
it("POST - Create a screen with each role type", async () => {
|
||||||
// Create app
|
// Create app
|
||||||
const [appResponse, app] = await appConfig.applications.create(generateApp())
|
const [appResponse, app] = await appConfig.applications.create(generateApp())
|
||||||
expect(appResponse).toHaveStatusCode(200)
|
expect(appResponse).toHaveStatusCode(200)
|
||||||
expect(app._id).toBeDefined()
|
expect(app._id).toBeDefined()
|
||||||
|
|
||||||
// Create Screen
|
// Create Screen
|
||||||
|
const roleArray = ["BASIC", "POWER", "ADMIN", "PUBLIC"]
|
||||||
appConfig.applications.api.appId = app.appId
|
appConfig.applications.api.appId = app.appId
|
||||||
const [response, screen] = await config.screen.createScreen(generateScreen())
|
for (let i = 0; i < 4; i++) {
|
||||||
expect(response).toHaveStatusCode(200)
|
const [response, screen] = await config.screen.createScreen(generateScreen(roleArray[i]))
|
||||||
expect(screen.routing.roleId).toEqual("BASIC")
|
expect(response).toHaveStatusCode(200)
|
||||||
|
expect(screen.routing.roleId).toEqual(roleArray[i])
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
it("GET - Fetch screens", async () => {
|
it("GET - Fetch screens", async () => {
|
||||||
|
@ -40,7 +43,7 @@ describe("Internal API - /screens endpoints", () => {
|
||||||
|
|
||||||
// Create Screen
|
// Create Screen
|
||||||
appConfig.applications.api.appId = app.appId
|
appConfig.applications.api.appId = app.appId
|
||||||
const [response, screen] = await config.screen.createScreen(generateScreen())
|
const [response, screen] = await config.screen.createScreen(generateScreen("BASIC"))
|
||||||
expect(response).toHaveStatusCode(200)
|
expect(response).toHaveStatusCode(200)
|
||||||
|
|
||||||
// Check screen exists
|
// Check screen exists
|
||||||
|
@ -57,7 +60,7 @@ describe("Internal API - /screens endpoints", () => {
|
||||||
|
|
||||||
// Create Screen
|
// Create Screen
|
||||||
appConfig.applications.api.appId = app.appId
|
appConfig.applications.api.appId = app.appId
|
||||||
const [screenResponse, screen] = await config.screen.createScreen(generateScreen())
|
const [screenResponse, screen] = await config.screen.createScreen(generateScreen("BASIC"))
|
||||||
expect(screenResponse).toHaveStatusCode(200)
|
expect(screenResponse).toHaveStatusCode(200)
|
||||||
expect(screen._id).toBeDefined()
|
expect(screen._id).toBeDefined()
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue