From 2ca2d39b1e4f45f0cc9446dae9720baac842f67f Mon Sep 17 00:00:00 2001 From: andreidubov Date: Fri, 26 Jun 2020 13:17:24 +0300 Subject: [PATCH 1/2] Code formatting --- src/script/management-sdk.ts | 10 ++-- src/test/superagent-mock-config.js | 94 +++++++++++++++--------------- 2 files changed, 52 insertions(+), 52 deletions(-) diff --git a/src/script/management-sdk.ts b/src/script/management-sdk.ts index 61f1fd07..404d4e99 100644 --- a/src/script/management-sdk.ts +++ b/src/script/management-sdk.ts @@ -72,7 +72,7 @@ class AccountManager { } public isAuthenticated(throwIfUnauthorized?: boolean): Promise { - return new Promise((resolve, reject) => { + return new Promise((resolve, reject) => { var request: superagent.Request = superagent.get(this._serverUrl + urlEncode`/authenticated`); if (this._proxy) (request).proxy(this._proxy); this.attachCredentials(request); @@ -367,7 +367,7 @@ class AccountManager { private packageFileFromPath(filePath: string): Promise { var getPackageFilePromise: Promise; if (fs.lstatSync(filePath).isDirectory()) { - getPackageFilePromise = new Promise((resolve: (file: PackageFile) => void, reject: (reason: Error) => void): void => { + getPackageFilePromise = new Promise((resolve: (file: PackageFile) => void, reject: (reason: Error) => void): void => { var directoryPath: string = filePath; recursiveFs.readdirr(directoryPath, (error?: any, directories?: string[], files?: string[]): void => { @@ -405,9 +405,9 @@ class AccountManager { }); }); } else { - getPackageFilePromise = new Promise((resolve: (file: PackageFile) => void, reject: (reason: Error) => void): void => { - resolve({ isTemporary: false, path: filePath }); - }); + getPackageFilePromise = new Promise((resolve: (file: PackageFile) => void, reject: (reason: Error) => void): void => { + resolve({ isTemporary: false, path: filePath }); + }); } return getPackageFilePromise; } diff --git a/src/test/superagent-mock-config.js b/src/test/superagent-mock-config.js index a68c18e9..9dc6779f 100644 --- a/src/test/superagent-mock-config.js +++ b/src/test/superagent-mock-config.js @@ -1,55 +1,55 @@ // ./superagent-mock-config.js file module.exports = [ - { - pattern: 'http://localhost/(\\w+)/', + { + pattern: 'http://localhost/(\\w+)/', - /** - * returns the data - * - * @param match array Result of the resolution of the regular expression - * @param params object sent by 'send' function - */ - fixtures: function (match, params) { - return {text: "Error", status: 403, ok: false}; + /** + * returns the data + * + * @param match array Result of the resolution of the regular expression + * @param params object sent by 'send' function + */ + fixtures: function (match, params) { + return { text: "Error", status: 403, ok: false }; - /** - * example: - * request.get('https://error.example/404').end(function(err, res){ - * console.log(err); // 404 - * }) - */ - if (match[1] === '404') { - throw new Error(404); - } + /** + * example: + * request.get('https://error.example/404').end(function(err, res){ + * console.log(err); // 404 + * }) + */ + if (match[1] === '404') { + throw new Error(404); + } - /** - * example: - * request.get('https://error.example/200').end(function(err, res){ - * console.log(res.body); // "Data fixtures" - * }) - */ + /** + * example: + * request.get('https://error.example/200').end(function(err, res){ + * console.log(res.body); // "Data fixtures" + * }) + */ - /** - * example: - * request.get('https://domain.send.example/').send({superhero: "me"}).end(function(err, res){ - * console.log(res.body); // "Data fixtures - superhero:me" - * }) - */ - if(params["superhero"]) { - return 'Data fixtures - superhero:' + params["superhero"]; - } else { - return 'Data fixtures'; - } - }, + /** + * example: + * request.get('https://domain.send.example/').send({superhero: "me"}).end(function(err, res){ + * console.log(res.body); // "Data fixtures - superhero:me" + * }) + */ + if (params["superhero"]) { + return 'Data fixtures - superhero:' + params["superhero"]; + } else { + return 'Data fixtures'; + } + }, - /** - * returns the result of the request - * - * @param match array Result of the resolution of the regular expression - * @param data mixed Data returns by `fixtures` attribute - */ - callback: function (match, data) { - return data; - } - }, + /** + * returns the result of the request + * + * @param match array Result of the resolution of the regular expression + * @param data mixed Data returns by `fixtures` attribute + */ + callback: function (match, data) { + return data; + } + }, ]; \ No newline at end of file From fe4209281ab657a4433218d768fd1bcea627e7d8 Mon Sep 17 00:00:00 2001 From: andreidubov Date: Fri, 26 Jun 2020 13:18:32 +0300 Subject: [PATCH 2/2] Add space --- src/test/superagent-mock-config.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/superagent-mock-config.js b/src/test/superagent-mock-config.js index 9dc6779f..9a387ea2 100644 --- a/src/test/superagent-mock-config.js +++ b/src/test/superagent-mock-config.js @@ -52,4 +52,4 @@ module.exports = [ return data; } }, -]; \ No newline at end of file +];