From 40d204fbb253523920b078ae1c012c1945b12a22 Mon Sep 17 00:00:00 2001 From: Rory Powell Date: Wed, 12 Oct 2022 10:25:02 +0100 Subject: [PATCH] Fix linting --- packages/server/src/integrations/rest.ts | 2 +- .../TestConfiguration/applications.ts | 11 +++-- .../internal-api/fixtures/types/appPackage.ts | 6 +-- .../internal-api/fixtures/types/deploy.ts | 7 ++-- .../internal-api/fixtures/types/routing.ts | 14 +++---- .../internal-api/applications/create.spec.ts | 40 ++++++++++++------- 6 files changed, 47 insertions(+), 33 deletions(-) diff --git a/packages/server/src/integrations/rest.ts b/packages/server/src/integrations/rest.ts index cab8263720..71294b9cb0 100644 --- a/packages/server/src/integrations/rest.ts +++ b/packages/server/src/integrations/rest.ts @@ -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}` diff --git a/qa-core/src/config/internal-api/TestConfiguration/applications.ts b/qa-core/src/config/internal-api/TestConfiguration/applications.ts index 36abb7db36..3b50a62781 100644 --- a/qa-core/src/config/internal-api/TestConfiguration/applications.ts +++ b/qa-core/src/config/internal-api/TestConfiguration/applications.ts @@ -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] } - } diff --git a/qa-core/src/config/internal-api/fixtures/types/appPackage.ts b/qa-core/src/config/internal-api/fixtures/types/appPackage.ts index e21e91f78f..0285565dea 100644 --- a/qa-core/src/config/internal-api/fixtures/types/appPackage.ts +++ b/qa-core/src/config/internal-api/fixtures/types/appPackage.ts @@ -3,7 +3,7 @@ import { Layout } from "@budibase/types" import { Screen } from "@budibase/types" // Create type for getAppPackage response export interface AppPackageResponse { - application: Partial, - layout: Layout, - screens: Screen[] + application: Partial + layout: Layout + screens: Screen[] } diff --git a/qa-core/src/config/internal-api/fixtures/types/deploy.ts b/qa-core/src/config/internal-api/fixtures/types/deploy.ts index f859f3255b..77acb3bb52 100644 --- a/qa-core/src/config/internal-api/fixtures/types/deploy.ts +++ b/qa-core/src/config/internal-api/fixtures/types/deploy.ts @@ -1,6 +1,5 @@ - export interface DeployConfig { - appUrl: string, - status: string, - "_id": string + appUrl: string + status: string + _id: string } diff --git a/qa-core/src/config/internal-api/fixtures/types/routing.ts b/qa-core/src/config/internal-api/fixtures/types/routing.ts index 0cddcdffb9..c898d7fecd 100644 --- a/qa-core/src/config/internal-api/fixtures/types/routing.ts +++ b/qa-core/src/config/internal-api/fixtures/types/routing.ts @@ -1,17 +1,17 @@ export interface RouteConfig { - routes: Record + routes: Record } export interface Route { - subpaths: Record + subpaths: Record } export interface Subpath { - screens: ScreenRouteConfig + screens: ScreenRouteConfig } export interface ScreenRouteConfig { - BASIC?: string - POWER?: string - ADMIN?: string -} \ No newline at end of file + BASIC?: string + POWER?: string + ADMIN?: string +} diff --git a/qa-core/src/tests/internal-api/applications/create.spec.ts b/qa-core/src/tests/internal-api/applications/create.spec.ts index bed1b43790..c09af632de 100644 --- a/qa-core/src/tests/internal-api/applications/create.spec.ts +++ b/qa-core/src/tests/internal-api/applications/create.spec.ts @@ -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(app.appId) + const [syncResponse, sync] = await config.applications.sync( + 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(app.appId) + const [syncResponse, sync] = await config.applications.sync( + 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(app.appId, { - name: generator.word(), - }) + const [updateResponse, updatedApp] = await config.applications.update( + 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(app.appId) + const [revertResponse, revert] = await config.applications.revert( + 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(app.appId) + const [revertResponse, revert] = await config.applications.revert( + 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(app.appId) expect(deleteResponse).toHaveStatusCode(200) }) - })