Merge pull request #8438 from Budibase/add-app-flows-to-api-tests
Add app flows to api tests
This commit is contained in:
commit
cd0928106b
|
@ -7,6 +7,7 @@ import { RouteConfig } from "../fixtures/types/routing"
|
||||||
import { AppPackageResponse } from "../fixtures/types/appPackage"
|
import { AppPackageResponse } from "../fixtures/types/appPackage"
|
||||||
import { DeployConfig } from "../fixtures/types/deploy"
|
import { DeployConfig } from "../fixtures/types/deploy"
|
||||||
import { responseMessage } from "../fixtures/types/responseMessage"
|
import { responseMessage } from "../fixtures/types/responseMessage"
|
||||||
|
import { UnpublishAppResponse } from "../fixtures/types/unpublishAppResponse"
|
||||||
|
|
||||||
export default class AppApi {
|
export default class AppApi {
|
||||||
api: InternalAPIClient
|
api: InternalAPIClient
|
||||||
|
@ -100,4 +101,14 @@ export default class AppApi {
|
||||||
const json = await response.json()
|
const json = await response.json()
|
||||||
return [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]
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,7 @@
|
||||||
|
export interface UnpublishAppResponse {
|
||||||
|
data: {
|
||||||
|
ok: boolean
|
||||||
|
},
|
||||||
|
ok: boolean,
|
||||||
|
status: number
|
||||||
|
}
|
|
@ -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
|
// create the app
|
||||||
const appName = generator.word()
|
const appName = generator.word()
|
||||||
const app = await createAppFromTemplate()
|
const app = await createAppFromTemplate()
|
||||||
|
@ -83,6 +83,10 @@ describe("Internal API - /applications endpoints", () => {
|
||||||
const [publishedAppResponse, publishedAppRenders] =
|
const [publishedAppResponse, publishedAppRenders] =
|
||||||
await config.applications.canRender()
|
await config.applications.canRender()
|
||||||
expect(publishedAppRenders).toBe(true)
|
expect(publishedAppRenders).toBe(true)
|
||||||
|
|
||||||
|
// unpublish app
|
||||||
|
await config.applications.unpublish(<string>app.appId)
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
it("POST - Sync application before deployment", async () => {
|
it("POST - Sync application before deployment", async () => {
|
||||||
|
|
Loading…
Reference in New Issue