From 815d0a219d5bd5a6cf2413dc3e040bdf2cf884e5 Mon Sep 17 00:00:00 2001 From: Matthew J Martin <19975+matmar10@users.noreply.github.com> Date: Mon, 4 Apr 2022 02:35:44 +0700 Subject: [PATCH] refactor: rename core classes to match new project name --- lib/main.js | 6 +++--- lib/request.js | 10 +++++----- lib/response.js | 2 +- lib/{just-api.js => rest-ez.js} | 2 +- lib/spec.js | 4 ++-- 5 files changed, 12 insertions(+), 12 deletions(-) rename lib/{just-api.js => rest-ez.js} (99%) diff --git a/lib/main.js b/lib/main.js index f5a1193..dc5ac52 100644 --- a/lib/main.js +++ b/lib/main.js @@ -16,7 +16,7 @@ process const program = require('commander'); import fs from 'fs'; import path from 'path'; -import JustAPI from './just-api'; +import RestEZ from './rest-ez'; import { findSuiteFiles, doesDirectoryExist } from './utils'; program @@ -80,5 +80,5 @@ let additionalOptions = { reporterOptions: program.reporterOptions }; -const justAPI = new JustAPI(suiteFiles, additionalOptions); -justAPI.init(); +const restEZ = new RestEZ(suiteFiles, additionalOptions); +restEZ.init(); diff --git a/lib/request.js b/lib/request.js index 0c67476..6490342 100644 --- a/lib/request.js +++ b/lib/request.js @@ -1,9 +1,9 @@ 'use strict'; const request = require('request'); -import JustAPIResponse from './response'; +import RestEZResponse from './response'; -export default class JustAPIRequest { +export default class RestEZRequest { constructor(options, test) { this.options = options; this.test = test; @@ -13,7 +13,7 @@ export default class JustAPIRequest { if (this.options.cookiesData && Object.keys(this.options.cookiesData).length > 0) { let cookieJar = request.jar(); - + for (let [ key, value ] of Object.entries(this.options.cookiesData)) { cookieJar.setCookie(request.cookie(`${key}=${value}`), this.options.baseUrl || this.options.url); } @@ -60,8 +60,8 @@ export default class JustAPIRequest { self.test.suite.requests.push(log); - let justAPIResponse = new JustAPIResponse(this, err, response, body); - return resolve(justAPIResponse); + let restEZResponse = new RestEZResponse(this, err, response, body); + return resolve(restEZResponse); }); }); diff --git a/lib/response.js b/lib/response.js index ad4c3ff..bf789d4 100644 --- a/lib/response.js +++ b/lib/response.js @@ -1,6 +1,6 @@ 'use strict'; -export default class JustAPIResponse { +export default class RestEZResponse { constructor(req, err, response, body) { this._req = req; diff --git a/lib/just-api.js b/lib/rest-ez.js similarity index 99% rename from lib/just-api.js rename to lib/rest-ez.js index 4e7bcd4..10bb631 100644 --- a/lib/just-api.js +++ b/lib/rest-ez.js @@ -9,7 +9,7 @@ import { isNumber } from './utils'; const MAX_PARALLEL_LIMIT = 24; -export default class JustAPI { +export default class RestEZ { constructor(suiteFiles, options) { this.suites = suiteFiles; diff --git a/lib/spec.js b/lib/spec.js index 96eb965..efd2f95 100644 --- a/lib/spec.js +++ b/lib/spec.js @@ -1,6 +1,6 @@ 'use strict'; -import JustAPIRequest from './request'; +import RestEZRequest from './request'; import fs from 'fs'; import path from 'path'; import { assertFileValidity, loadModule, runModuleFunction, runInlineFunction, wait, isNumber, equals as isEqual } from './utils'; @@ -222,7 +222,7 @@ export default class Spec { } async processRequest(opts) { - let _req = new JustAPIRequest(opts, this); + let _req = new RestEZRequest(opts, this); return _req.send(); }