Fix linting
This commit is contained in:
parent
10866e66d2
commit
6e083c85a4
|
@ -225,7 +225,7 @@ class RestIntegration implements IntegrationBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (queryString) {
|
if (queryString) {
|
||||||
// make sure the query string is fully encoded
|
// make sure the query string is fully encoded
|
||||||
queryString = "?" + qs.encode(qs.decode(queryString))
|
queryString = "?" + qs.encode(qs.decode(queryString))
|
||||||
}
|
}
|
||||||
const main = `${path}${queryString}`
|
const main = `${path}${queryString}`
|
||||||
|
|
|
@ -58,8 +58,14 @@ export default class AppApi {
|
||||||
return [response, json]
|
return [response, json]
|
||||||
}
|
}
|
||||||
|
|
||||||
async updateClient(appId: string, body: any): Promise<[Response, Application]> {
|
async updateClient(
|
||||||
const response = await this.api.put(`/applications/${appId}/client/update`, { body })
|
appId: string,
|
||||||
|
body: any
|
||||||
|
): Promise<[Response, Application]> {
|
||||||
|
const response = await this.api.put(
|
||||||
|
`/applications/${appId}/client/update`,
|
||||||
|
{ body }
|
||||||
|
)
|
||||||
const json = await response.json()
|
const json = await response.json()
|
||||||
return [response, json]
|
return [response, json]
|
||||||
}
|
}
|
||||||
|
@ -93,5 +99,4 @@ export default class AppApi {
|
||||||
const json = await response.json()
|
const json = await response.json()
|
||||||
return [response, json]
|
return [response, json]
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,7 @@ import { Layout } from "@budibase/types"
|
||||||
import { Screen } from "@budibase/types"
|
import { Screen } from "@budibase/types"
|
||||||
// Create type for getAppPackage response
|
// Create type for getAppPackage response
|
||||||
export interface AppPackageResponse {
|
export interface AppPackageResponse {
|
||||||
application: Partial<Application>,
|
application: Partial<Application>
|
||||||
layout: Layout,
|
layout: Layout
|
||||||
screens: Screen[]
|
screens: Screen[]
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
|
|
||||||
export interface DeployConfig {
|
export interface DeployConfig {
|
||||||
appUrl: string,
|
appUrl: string
|
||||||
status: string,
|
status: string
|
||||||
"_id": string
|
_id: string
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,17 +1,17 @@
|
||||||
export interface RouteConfig {
|
export interface RouteConfig {
|
||||||
routes: Record<string, Route>
|
routes: Record<string, Route>
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface Route {
|
export interface Route {
|
||||||
subpaths: Record<string, Subpath>
|
subpaths: Record<string, Subpath>
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface Subpath {
|
export interface Subpath {
|
||||||
screens: ScreenRouteConfig
|
screens: ScreenRouteConfig
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ScreenRouteConfig {
|
export interface ScreenRouteConfig {
|
||||||
BASIC?: string
|
BASIC?: string
|
||||||
POWER?: string
|
POWER?: string
|
||||||
ADMIN?: string
|
ADMIN?: string
|
||||||
}
|
}
|
|
@ -92,10 +92,12 @@ describe("Internal API - /applications endpoints", () => {
|
||||||
expect(app.appId).toBeDefined()
|
expect(app.appId).toBeDefined()
|
||||||
config.applications.api.appId = app.appId
|
config.applications.api.appId = app.appId
|
||||||
|
|
||||||
const [syncResponse, sync] = await config.applications.sync(<string>app.appId)
|
const [syncResponse, sync] = await config.applications.sync(
|
||||||
|
<string>app.appId
|
||||||
|
)
|
||||||
expect(syncResponse).toHaveStatusCode(200)
|
expect(syncResponse).toHaveStatusCode(200)
|
||||||
expect(sync).toEqual({
|
expect(sync).toEqual({
|
||||||
message: "App sync not required, app not deployed."
|
message: "App sync not required, app not deployed.",
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -108,10 +110,12 @@ describe("Internal API - /applications endpoints", () => {
|
||||||
// publish app
|
// publish app
|
||||||
await config.applications.publish()
|
await config.applications.publish()
|
||||||
|
|
||||||
const [syncResponse, sync] = await config.applications.sync(<string>app.appId)
|
const [syncResponse, sync] = await config.applications.sync(
|
||||||
|
<string>app.appId
|
||||||
|
)
|
||||||
expect(syncResponse).toHaveStatusCode(200)
|
expect(syncResponse).toHaveStatusCode(200)
|
||||||
expect(sync).toEqual({
|
expect(sync).toEqual({
|
||||||
message: "App sync completed successfully."
|
message: "App sync completed successfully.",
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -121,9 +125,12 @@ describe("Internal API - /applications endpoints", () => {
|
||||||
expect(app.appId).toBeDefined()
|
expect(app.appId).toBeDefined()
|
||||||
config.applications.api.appId = app.appId
|
config.applications.api.appId = app.appId
|
||||||
|
|
||||||
const [updateResponse, updatedApp] = await config.applications.update(<string>app.appId, {
|
const [updateResponse, updatedApp] = await config.applications.update(
|
||||||
name: generator.word(),
|
<string>app.appId,
|
||||||
})
|
{
|
||||||
|
name: generator.word(),
|
||||||
|
}
|
||||||
|
)
|
||||||
expect(updateResponse).toHaveStatusCode(200)
|
expect(updateResponse).toHaveStatusCode(200)
|
||||||
expect(updatedApp.name).not.toEqual(app.name)
|
expect(updatedApp.name).not.toEqual(app.name)
|
||||||
})
|
})
|
||||||
|
@ -134,15 +141,16 @@ describe("Internal API - /applications endpoints", () => {
|
||||||
expect(app.appId).toBeDefined()
|
expect(app.appId).toBeDefined()
|
||||||
config.applications.api.appId = app.appId
|
config.applications.api.appId = app.appId
|
||||||
|
|
||||||
const [revertResponse, revert] = await config.applications.revert(<string>app.appId)
|
const [revertResponse, revert] = await config.applications.revert(
|
||||||
|
<string>app.appId
|
||||||
|
)
|
||||||
expect(revertResponse).toHaveStatusCode(400)
|
expect(revertResponse).toHaveStatusCode(400)
|
||||||
expect(revert).toEqual({
|
expect(revert).toEqual({
|
||||||
message: "App has not yet been deployed",
|
message: "App has not yet been deployed",
|
||||||
status: 400
|
status: 400,
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
it("POST - Revert Changes", async () => {
|
it("POST - Revert Changes", async () => {
|
||||||
const [response, app] = await config.applications.create(generateApp())
|
const [response, app] = await config.applications.create(generateApp())
|
||||||
expect(response).toHaveStatusCode(200)
|
expect(response).toHaveStatusCode(200)
|
||||||
|
@ -155,22 +163,25 @@ describe("Internal API - /applications endpoints", () => {
|
||||||
expect(publish.status).toEqual("SUCCESS")
|
expect(publish.status).toEqual("SUCCESS")
|
||||||
|
|
||||||
// Change/add component to the app
|
// Change/add component to the app
|
||||||
const [screenResponse, screen] = await config.applications.addScreentoApp(generateScreen())
|
const [screenResponse, screen] = await config.applications.addScreentoApp(
|
||||||
|
generateScreen()
|
||||||
|
)
|
||||||
expect(screenResponse).toHaveStatusCode(200)
|
expect(screenResponse).toHaveStatusCode(200)
|
||||||
expect(screen._id).toBeDefined()
|
expect(screen._id).toBeDefined()
|
||||||
|
|
||||||
// // Revert the app to published state
|
// // Revert the app to published state
|
||||||
const [revertResponse, revert] = await config.applications.revert(<string>app.appId)
|
const [revertResponse, revert] = await config.applications.revert(
|
||||||
|
<string>app.appId
|
||||||
|
)
|
||||||
expect(revertResponse).toHaveStatusCode(200)
|
expect(revertResponse).toHaveStatusCode(200)
|
||||||
expect(revert).toEqual({
|
expect(revert).toEqual({
|
||||||
message: "Reverted changes successfully."
|
message: "Reverted changes successfully.",
|
||||||
})
|
})
|
||||||
|
|
||||||
// Check screen is removed
|
// Check screen is removed
|
||||||
const [routesResponse, routes] = await config.applications.getRoutes()
|
const [routesResponse, routes] = await config.applications.getRoutes()
|
||||||
expect(routesResponse).toHaveStatusCode(200)
|
expect(routesResponse).toHaveStatusCode(200)
|
||||||
expect(routes.routes["/test"]).toBeUndefined()
|
expect(routes.routes["/test"]).toBeUndefined()
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
it("DELETE - Delete an application", async () => {
|
it("DELETE - Delete an application", async () => {
|
||||||
|
@ -181,5 +192,4 @@ describe("Internal API - /applications endpoints", () => {
|
||||||
const [deleteResponse] = await config.applications.delete(<string>app.appId)
|
const [deleteResponse] = await config.applications.delete(<string>app.appId)
|
||||||
expect(deleteResponse).toHaveStatusCode(200)
|
expect(deleteResponse).toHaveStatusCode(200)
|
||||||
})
|
})
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in New Issue