Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

testrail-api-client

Package Overview
Dependencies
Maintainers
1
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

testrail-api-client - npm Package Compare versions

Comparing version 1.0.16 to 1.0.18

69

dist/testrail.js

@@ -6,5 +6,30 @@ "use strict";

function TestRailClient(options) {
var _this = this;
this.options = options;
this.uri = "/index.php?/api/v2";
this.base = "https://" + options.domain + this.uri;
this.indexUri = "/index.php?";
this.uri = this.indexUri + "/api/v2";
this.commonHeaders = { 'Content-Type': 'application/json', 'x-api-ident': 'beta' };
this.handlePaginatedGetAxios = function (requestUrl, itemName, items, resolve, reject) {
var __this = _this;
axios({
method: 'get',
url: requestUrl,
headers: _this.commonHeaders,
auth: {
username: _this.options.username,
password: _this.options.password,
}
})
.then(function (response) {
var retrievedItems = items.concat(response.data[itemName]);
if (response.data._links.next !== null) {
__this.handlePaginatedGetAxios(__this.indexUri + "/" + response.data._links.next, itemName, retrievedItems, resolve, reject);
}
else {
resolve(retrievedItems);
}
})
.catch(function (error) { reject(error); });
};
axios.defaults.baseURL = "https://" + options.domain;
}

@@ -25,4 +50,4 @@ TestRailClient.prototype.addRun = function (name, description, projectId, suiteId, cases) {

method: 'post',
url: _this.base + "/add_run/" + projectId,
headers: { 'Content-Type': 'application/json' },
url: _this.uri + "/add_run/" + projectId,
headers: _this.commonHeaders,
auth: {

@@ -41,13 +66,3 @@ username: _this.options.username,

return new Promise(function (resolve, reject) {
axios({
method: 'GET',
url: _this.base + "/get_tests/" + runId,
headers: { 'Content-Type': 'application/json' },
auth: {
username: _this.options.username,
password: _this.options.password,
},
})
.then(function (response) { resolve(response.data); })
.catch(function (error) { reject(error); });
_this.handlePaginatedGetAxios(_this.uri + "/get_tests/" + runId, 'tests', [], resolve, reject);
});

@@ -60,13 +75,3 @@ };

+ (suiteId ? "/&suite_id=" + suiteId : "");
axios({
method: 'get',
url: _this.base + "/get_cases/" + projectId + params,
headers: { 'Content-Type': 'application/json' },
auth: {
username: _this.options.username,
password: _this.options.password,
}
})
.then(function (response) { resolve(response.data); })
.catch(function (error) { reject(error); });
_this.handlePaginatedGetAxios(_this.uri + "/get_cases/" + projectId + params, 'cases', [], resolve, reject);
});

@@ -80,4 +85,4 @@ };

method: 'post',
url: _this.base + "/close_run/" + runId,
headers: { 'Content-Type': 'application/json' },
url: _this.uri + "/close_run/" + runId,
headers: _this.commonHeaders,
auth: {

@@ -97,4 +102,4 @@ username: _this.options.username,

method: 'post',
url: _this.base + "/add_results_for_cases/" + runId,
headers: { 'Content-Type': 'application/json' },
url: _this.uri + "/add_results_for_cases/" + runId,
headers: _this.commonHeaders,
auth: {

@@ -117,4 +122,4 @@ username: _this.options.username,

method: 'post',
url: _this.base + "/update_run/" + runId,
headers: { 'Content-Type': 'application/json' },
url: _this.uri + "/update_run/" + runId,
headers: _this.commonHeaders,
auth: {

@@ -121,0 +126,0 @@ username: _this.options.username,

{
"name": "testrail-api-client",
"version": "1.0.16",
"version": "1.0.18",
"description": "JavaScript client for TestRail API",

@@ -24,3 +24,3 @@ "main": "index.js",

"dependencies": {
"axios": "^0.19.2"
"axios": "^0.21.1"
},

@@ -48,2 +48,2 @@ "devDependencies": {

}
}
}

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc