From 69aaaefce30331bf40141e33d0e0aeae40708443 Mon Sep 17 00:00:00 2001 From: MS Date: Mon, 1 Feb 2021 13:38:15 +0100 Subject: prettify code --- .../src/integrationtests/harness.ts | 14 +++-- .../src/integrationtests/libeufin.ts | 73 ++++++++-------------- 2 files changed, 34 insertions(+), 53 deletions(-) (limited to 'packages') diff --git a/packages/taler-wallet-cli/src/integrationtests/harness.ts b/packages/taler-wallet-cli/src/integrationtests/harness.ts index 3a56f4cda..396a0d34e 100644 --- a/packages/taler-wallet-cli/src/integrationtests/harness.ts +++ b/packages/taler-wallet-cli/src/integrationtests/harness.ts @@ -116,8 +116,10 @@ interface WaitResult { * Returns a new object being the current environment * plus the values given in the parameter. */ -export function extendEnv(extension: {[index: string]: string}): {[index: string]: string | undefined} { - let ret: {[index: string]: string | undefined} = {}; +export function extendEnv(extension: { + [index: string]: string; +}): { [index: string]: string | undefined } { + let ret: { [index: string]: string | undefined } = {}; for (let v in process.env) { ret[v] = process.env[v]; } @@ -190,7 +192,7 @@ export async function runCommand( logName: string, command: string, args: string[], - env: {[index: string]: string | undefined} = process.env + env: { [index: string]: string | undefined } = process.env, ): Promise { console.log("runing command", shellescape([command, ...args])); return new Promise((resolve, reject) => { @@ -198,7 +200,7 @@ export async function runCommand( const proc = spawn(command, args, { stdio: ["inherit", "pipe", "pipe"], shell: false, - env: env + env: env, }); proc.stdout.on("data", (x) => { if (x instanceof Buffer) { @@ -340,14 +342,14 @@ export class GlobalTestState { command: string, args: string[], logName: string, - env: {[index: string] : string | undefined} = process.env + env: { [index: string]: string | undefined } = process.env, ): ProcessWrapper { console.log( `spawning process (${logName}): ${shellescape([command, ...args])}`, ); const proc = spawn(command, args, { stdio: ["inherit", "pipe", "pipe"], - env: env + env: env, }); console.log(`spawned process (${logName}) with pid ${proc.pid}`); proc.on("error", (err) => { diff --git a/packages/taler-wallet-cli/src/integrationtests/libeufin.ts b/packages/taler-wallet-cli/src/integrationtests/libeufin.ts index b4208801d..0e6fcfef7 100644 --- a/packages/taler-wallet-cli/src/integrationtests/libeufin.ts +++ b/packages/taler-wallet-cli/src/integrationtests/libeufin.ts @@ -24,7 +24,7 @@ import { pingProc, ProcessWrapper, runCommand, - extendEnv + extendEnv, } from "./harness"; export interface LibeufinSandboxServiceInterface { @@ -70,13 +70,11 @@ export class LibeufinSandboxService implements LibeufinSandboxServiceInterface { async start(): Promise { this.sandboxProc = this.globalTestState.spawnService( "libeufin-sandbox", - [ - "serve", - "--port", - `${this.sandboxConfig.httpPort}` - ], + ["serve", "--port", `${this.sandboxConfig.httpPort}`], "libeufin-sandbox", - extendEnv({LIBEUFIN_SANDBOX_DB_CONNECTION: this.sandboxConfig.databaseJdbcUri}) + extendEnv({ + LIBEUFIN_SANDBOX_DB_CONNECTION: this.sandboxConfig.databaseJdbcUri, + }), ); } @@ -110,24 +108,19 @@ export class LibeufinNexusService { this.globalTestState, "libeufin-nexus-superuser", "libeufin-nexus", - [ - "superuser", - "admin", - "--password", - "test" - ], - extendEnv({LIBEUFIN_NEXUS_DB_CONNECTION: this.nexusConfig.databaseJdbcUri}) + ["superuser", "admin", "--password", "test"], + extendEnv({ + LIBEUFIN_NEXUS_DB_CONNECTION: this.nexusConfig.databaseJdbcUri, + }), ); this.nexusProc = this.globalTestState.spawnService( "libeufin-nexus", - [ - "serve", - "--port", - `${this.nexusConfig.httpPort}`, - ], + ["serve", "--port", `${this.nexusConfig.httpPort}`], "libeufin-nexus", - extendEnv({LIBEUFIN_NEXUS_DB_CONNECTION: this.nexusConfig.databaseJdbcUri}) + extendEnv({ + LIBEUFIN_NEXUS_DB_CONNECTION: this.nexusConfig.databaseJdbcUri, + }), ); } @@ -284,7 +277,7 @@ export interface PostNexusPermissionRequest { resourceType: string; resourceId: string; permissionName: string; - } + }; } export namespace LibeufinNexusApi { @@ -411,20 +404,13 @@ export namespace LibeufinNexusApi { req: CreateNexusUserRequest, ) { const baseUrl = libeufinNexusService.baseUrl; - let url = new URL( - `/users`, - baseUrl, - ); - await axios.post( - url.href, - req, - { - auth: { - username: "admin", - password: "test", - }, + let url = new URL(`/users`, baseUrl); + await axios.post(url.href, req, { + auth: { + username: "admin", + password: "test", }, - ); + }); } export async function postPermission( @@ -432,20 +418,13 @@ export namespace LibeufinNexusApi { req: PostNexusPermissionRequest, ) { const baseUrl = libeufinNexusService.baseUrl; - let url = new URL( - `/permissions`, - baseUrl, - ); - await axios.post( - url.href, - req, - { - auth: { - username: "admin", - password: "test", - }, + let url = new URL(`/permissions`, baseUrl); + await axios.post(url.href, req, { + auth: { + username: "admin", + password: "test", }, - ); + }); } export async function createTwgFacade( -- cgit v1.2.3