1
0
Fork 0
mirror of synced 2024-06-02 10:34:40 +12:00

Add missing test to app flow

This commit is contained in:
Pedro Silva 2022-10-28 16:48:29 +01:00
parent da3f64d593
commit 9f96884980
3 changed files with 23 additions and 1 deletions

View file

@ -7,6 +7,7 @@ import { RouteConfig } from "../fixtures/types/routing"
import { AppPackageResponse } from "../fixtures/types/appPackage"
import { DeployConfig } from "../fixtures/types/deploy"
import { responseMessage } from "../fixtures/types/responseMessage"
import { UnpublishAppResponse } from "../fixtures/types/unpublishAppResponse"
export default class AppApi {
api: InternalAPIClient
@ -100,4 +101,14 @@ export default class AppApi {
const json = await response.json()
return [response, json]
}
async unpublish(appId: string): Promise<[Response, UnpublishAppResponse]> {
const response = await this.api.del(`/applications/${appId}?unpublish=1`)
expect(response).toHaveStatusCode(200)
const json = await response.json()
expect(json.data.ok).toBe(true)
expect(json.ok).toBe(true)
expect(json.status).toBe(200)
return [response, json]
}
}

View file

@ -0,0 +1,7 @@
export interface UnpublishAppResponse {
data: {
ok: boolean
},
ok: boolean,
status: number
}

View file

@ -63,7 +63,7 @@ describe("Internal API - /applications endpoints", () => {
})
})
it("POST - Create an application from a template, publish and check it renders", async () => {
it("Publish app flow", async () => {
// create the app
const appName = generator.word()
const app = await createAppFromTemplate()
@ -83,6 +83,10 @@ describe("Internal API - /applications endpoints", () => {
const [publishedAppResponse, publishedAppRenders] =
await config.applications.canRender()
expect(publishedAppRenders).toBe(true)
// unpublish app
await config.applications.unpublish(<string>app.appId)
})
it("POST - Sync application before deployment", async () => {