Fix linting

This commit is contained in:
Rory Powell 2022-10-12 10:25:02 +01:00
parent 10866e66d2
commit 6e083c85a4
6 changed files with 47 additions and 33 deletions

View File

@ -225,7 +225,7 @@ class RestIntegration implements IntegrationBase {
}
if (queryString) {
// make sure the query string is fully encoded
// make sure the query string is fully encoded
queryString = "?" + qs.encode(qs.decode(queryString))
}
const main = `${path}${queryString}`

View File

@ -58,8 +58,14 @@ export default class AppApi {
return [response, json]
}
async updateClient(appId: string, body: any): Promise<[Response, Application]> {
const response = await this.api.put(`/applications/${appId}/client/update`, { body })
async updateClient(
appId: string,
body: any
): Promise<[Response, Application]> {
const response = await this.api.put(
`/applications/${appId}/client/update`,
{ body }
)
const json = await response.json()
return [response, json]
}
@ -93,5 +99,4 @@ export default class AppApi {
const json = await response.json()
return [response, json]
}
}

View File

@ -3,7 +3,7 @@ import { Layout } from "@budibase/types"
import { Screen } from "@budibase/types"
// Create type for getAppPackage response
export interface AppPackageResponse {
application: Partial<Application>,
layout: Layout,
screens: Screen[]
application: Partial<Application>
layout: Layout
screens: Screen[]
}

View File

@ -1,6 +1,5 @@
export interface DeployConfig {
appUrl: string,
status: string,
"_id": string
appUrl: string
status: string
_id: string
}

View File

@ -1,17 +1,17 @@
export interface RouteConfig {
routes: Record<string, Route>
routes: Record<string, Route>
}
export interface Route {
subpaths: Record<string, Subpath>
subpaths: Record<string, Subpath>
}
export interface Subpath {
screens: ScreenRouteConfig
screens: ScreenRouteConfig
}
export interface ScreenRouteConfig {
BASIC?: string
POWER?: string
ADMIN?: string
}
BASIC?: string
POWER?: string
ADMIN?: string
}

View File

@ -92,10 +92,12 @@ describe("Internal API - /applications endpoints", () => {
expect(app.appId).toBeDefined()
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(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
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(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()
config.applications.api.appId = app.appId
const [updateResponse, updatedApp] = await config.applications.update(<string>app.appId, {
name: generator.word(),
})
const [updateResponse, updatedApp] = await config.applications.update(
<string>app.appId,
{
name: generator.word(),
}
)
expect(updateResponse).toHaveStatusCode(200)
expect(updatedApp.name).not.toEqual(app.name)
})
@ -134,15 +141,16 @@ describe("Internal API - /applications endpoints", () => {
expect(app.appId).toBeDefined()
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(revert).toEqual({
message: "App has not yet been deployed",
status: 400
status: 400,
})
})
it("POST - Revert Changes", async () => {
const [response, app] = await config.applications.create(generateApp())
expect(response).toHaveStatusCode(200)
@ -155,22 +163,25 @@ describe("Internal API - /applications endpoints", () => {
expect(publish.status).toEqual("SUCCESS")
// 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(screen._id).toBeDefined()
// // 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(revert).toEqual({
message: "Reverted changes successfully."
message: "Reverted changes successfully.",
})
// Check screen is removed
const [routesResponse, routes] = await config.applications.getRoutes()
expect(routesResponse).toHaveStatusCode(200)
expect(routes.routes["/test"]).toBeUndefined()
})
it("DELETE - Delete an application", async () => {
@ -181,5 +192,4 @@ describe("Internal API - /applications endpoints", () => {
const [deleteResponse] = await config.applications.delete(<string>app.appId)
expect(deleteResponse).toHaveStatusCode(200)
})
})