hyperactive
Advanced tools
Comparing version 2.2.2 to 2.3.0
{ | ||
"name": "hyperactive", | ||
"version": "2.2.2", | ||
"version": "2.3.0", | ||
"description": "Creates mocha tests for all hypermedia of your API", | ||
@@ -9,6 +9,6 @@ "author": "Tabcorp Digital Technology Team", | ||
"type": "git", | ||
"url": "https://github.com/TabDigital/hyperactive.git" | ||
"url": "https://github.com/Tabcorp/hyperactive.git" | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/TabDigital/hyperactive/issues" | ||
"url": "https://github.com/Tabcorp/hyperactive/issues" | ||
}, | ||
@@ -20,16 +20,15 @@ "main": "target/index.js", | ||
"devDependencies": { | ||
"coffee-script": "~1.7.1", | ||
"mocha": "~1.20.1", | ||
"require-lint": "~1.0.0", | ||
"sinon": "~1.10.3", | ||
"coffeescript": "~2.3.2", | ||
"mocha": "~5.2.0", | ||
"require-lint": "^1.3.0", | ||
"should": "~4.0.4", | ||
"irish-pub": "~0.1.0" | ||
"sinon": "~1.10.3" | ||
}, | ||
"dependencies": { | ||
"lodash": "~2.4.1", | ||
"async": "~2.0.1", | ||
"js-match": "~1.0.6", | ||
"unirest": "~0.2.7", | ||
"uri-templates": "~0.1.5", | ||
"async": "~0.9.0" | ||
"lodash": "^4.17.11", | ||
"unirest": "^0.5.1", | ||
"uri-templates": "~0.1.5" | ||
} | ||
} |
@@ -5,6 +5,6 @@ # hyperactive | ||
![Logo](https://raw.githubusercontent.com/TabDigital/hyperactive/master/logo.png) | ||
![Logo](https://raw.githubusercontent.com/Tabcorp/hyperactive/master/logo.png) | ||
[![Build Status](https://travis-ci.org/TabDigital/hyperactive.svg?branch=master)](https://travis-ci.org/TabDigital/hyperactive) | ||
[![Dependency Status](https://david-dm.org/TabDigital/hyperactive.png?theme=shields.io)](https://david-dm.org/TabDigital/hyperactive) [![devDependency Status](https://david-dm.org/TabDigital/hyperactive/dev-status.png?theme=shields.io)](https://david-dm.org/TabDigital/hyperactive#info=devDependencies) | ||
[![Build Status](https://travis-ci.org/Tabcorp/hyperactive.svg?branch=master)](https://travis-ci.org/Tabcorp/hyperactive) | ||
[![Dependency Status](https://david-dm.org/Tabcorp/hyperactive.png?theme=shields.io)](https://david-dm.org/Tabcorp/hyperactive) [![devDependency Status](https://david-dm.org/Tabcorp/hyperactive/dev-status.png?theme=shields.io)](https://david-dm.org/Tabcorp/hyperactive#info=devDependencies) | ||
@@ -11,0 +11,0 @@ [![npm install](https://nodei.co/npm/hyperactive.png?mini=true)](https://nodei.co/npm/hyperactive/) |
@@ -1,4 +0,4 @@ | ||
// Generated by CoffeeScript 1.7.1 | ||
// Generated by CoffeeScript 2.3.2 | ||
(function() { | ||
var DEFAULT_CONFIG, async, build, config, createIt, expandUrl, linkFilter, linkFinder, localItFunction, setIt, templates, validate, _; | ||
var DEFAULT_CONFIG, _, async, build, config, createIt, expandUrl, linkFilter, linkFinder, localItFunction, setIt, templates, validate; | ||
@@ -49,11 +49,9 @@ _ = require('lodash'); | ||
createIt = (function(_this) { | ||
return function(url, templateValues) { | ||
return localItFunction(url, function(done) { | ||
return build.request(url, config.options).end(function(res) { | ||
return exports.processResponse(url, res, templateValues, done); | ||
}); | ||
createIt = (url, templateValues) => { | ||
return localItFunction(url, (done) => { | ||
return build.request(url, config.options).end((res) => { | ||
return exports.processResponse(url, res, templateValues, done); | ||
}); | ||
}; | ||
})(this); | ||
}); | ||
}; | ||
@@ -66,48 +64,44 @@ exports.createItWithResult = function(url, err) { | ||
exports.processResponse = (function(_this) { | ||
return function(parent, res, templateValues, done) { | ||
var err; | ||
if (!res.ok) { | ||
if (!config.recover(res)) { | ||
err = "Bad status " + res.status + " for url " + res.url; | ||
exports.processResponse = (parent, res, templateValues, done) => { | ||
var err; | ||
if (!res.ok) { | ||
if (!config.recover(res)) { | ||
err = `Bad status ${res.status} for url ${res.url}`; | ||
} | ||
return done(err); | ||
} else { | ||
try { | ||
if (!validate(parent, res)) { | ||
return done(`Not a valid response: ${res.body}`); | ||
} | ||
} catch (error) { | ||
err = error; | ||
return done(err); | ||
} else { | ||
try { | ||
if (!validate(parent, res)) { | ||
return done("Not a valid response: " + res.body); | ||
} | ||
} catch (_error) { | ||
err = _error; | ||
return done(err); | ||
} | ||
} | ||
return describe("" + parent, function() { | ||
var requests; | ||
requests = _.map(exports.getLinks(res), function(link) { | ||
return function(callback) { | ||
var expandedLink; | ||
linkFilter.processLink(link); | ||
expandedLink = expandUrl(link, templateValues); | ||
return build.request(expandedLink, config.options).end((function(_this) { | ||
return function(res) { | ||
return exports.processResponse(expandedLink, res, templateValues, function(err) { | ||
return callback(null, { | ||
err: err, | ||
link: expandedLink | ||
}); | ||
}); | ||
}; | ||
})(this)); | ||
}; | ||
}); | ||
return async.parallel(requests, function(err, results) { | ||
results.forEach(function(result) { | ||
return exports.createItWithResult(result.link, result.err); | ||
} | ||
return describe(`${parent}`, function() { | ||
var requests; | ||
requests = _.map(exports.getLinks(res), function(link) { | ||
return function(callback) { | ||
var expandedLink; | ||
linkFilter.processLink(link); | ||
expandedLink = expandUrl(link, templateValues); | ||
return build.request(expandedLink, config.options).end((res) => { | ||
return exports.processResponse(expandedLink, res, templateValues, function(err) { | ||
return callback(null, { | ||
err, | ||
link: expandedLink | ||
}); | ||
}); | ||
}); | ||
return done(); | ||
}; | ||
}); | ||
return async.parallel(requests, function(err, results) { | ||
results.forEach(function(result) { | ||
return exports.createItWithResult(result.link, result.err); | ||
}); | ||
return done(); | ||
}); | ||
}; | ||
})(this); | ||
}); | ||
}; | ||
@@ -114,0 +108,0 @@ expandUrl = function(url, values) { |
@@ -1,2 +0,2 @@ | ||
// Generated by CoffeeScript 1.7.1 | ||
// Generated by CoffeeScript 2.3.2 | ||
(function() { | ||
@@ -3,0 +3,0 @@ var crawler, jsmatch, schema; |
@@ -1,4 +0,4 @@ | ||
// Generated by CoffeeScript 1.7.1 | ||
// Generated by CoffeeScript 2.3.2 | ||
(function() { | ||
var processedLinks, _; | ||
var _, processedLinks; | ||
@@ -18,3 +18,3 @@ _ = require('lodash'); | ||
exports.unprocessedLinks = function(links) { | ||
return _.filter(_.unique(links), function(link) { | ||
return _.filter(_.uniq(links), function(link) { | ||
return link !== void 0 && processedLinks[link] === void 0; | ||
@@ -34,3 +34,3 @@ }); | ||
} else { | ||
return _.sample(unprocessedLinks, exports.linksToSample(unprocessedLinks.length, samplePercentage)); | ||
return _.sampleSize(unprocessedLinks, exports.linksToSample(unprocessedLinks.length, samplePercentage)); | ||
} | ||
@@ -37,0 +37,0 @@ }; |
@@ -1,4 +0,4 @@ | ||
// Generated by CoffeeScript 1.7.1 | ||
// Generated by CoffeeScript 2.3.2 | ||
(function() { | ||
var linksForKey, _; | ||
var _, linksForKey; | ||
@@ -9,3 +9,3 @@ _ = require('lodash'); | ||
if (key === '_links') { | ||
return _.pluck(_.values(val), 'href'); | ||
return _.map(_.values(val), 'href'); | ||
} else if (typeof val === 'object') { | ||
@@ -19,5 +19,5 @@ return _.map(val, linksForKey); | ||
exports.getLinks = function(responseBody) { | ||
return _.flatten(linksForKey(responseBody, '')); | ||
return _.flattenDeep(linksForKey(responseBody, '')); | ||
}; | ||
}).call(this); |
@@ -1,2 +0,2 @@ | ||
// Generated by CoffeeScript 1.7.1 | ||
// Generated by CoffeeScript 2.3.2 | ||
(function() { | ||
@@ -3,0 +3,0 @@ var request; |
@@ -1,2 +0,2 @@ | ||
// Generated by CoffeeScript 1.7.1 | ||
// Generated by CoffeeScript 2.3.2 | ||
(function() { | ||
@@ -3,0 +3,0 @@ module.exports = { |
5
12518
195
+ Addedansi-regex@2.1.1(transitive)
+ Addedansi-styles@2.2.1(transitive)
+ Addedasn1@0.2.6(transitive)
+ Addedassert-plus@0.2.01.0.0(transitive)
+ Addedasync@2.0.1(transitive)
+ Addedaws-sign2@0.6.0(transitive)
+ Addedaws4@1.13.2(transitive)
+ Addedbcrypt-pbkdf@1.0.2(transitive)
+ Addedbl@1.1.2(transitive)
+ Addedboom@2.10.1(transitive)
+ Addedcaseless@0.11.0(transitive)
+ Addedchalk@1.1.3(transitive)
+ Addedcombined-stream@1.0.8(transitive)
+ Addedcommander@2.20.3(transitive)
+ Addedcore-util-is@1.0.21.0.3(transitive)
+ Addedcryptiles@2.0.5(transitive)
+ Addeddashdash@1.14.1(transitive)
+ Addeddelayed-stream@1.0.0(transitive)
+ Addedecc-jsbn@0.1.2(transitive)
+ Addedescape-string-regexp@1.0.5(transitive)
+ Addedextend@3.0.2(transitive)
+ Addedextsprintf@1.3.0(transitive)
+ Addedforever-agent@0.6.1(transitive)
+ Addedform-data@0.2.01.0.1(transitive)
+ Addedgenerate-function@2.3.1(transitive)
+ Addedgenerate-object-property@1.2.0(transitive)
+ Addedgetpass@0.1.7(transitive)
+ Addedhar-validator@2.0.6(transitive)
+ Addedhas-ansi@2.0.0(transitive)
+ Addedhawk@3.1.3(transitive)
+ Addedhoek@2.16.3(transitive)
+ Addedhttp-signature@1.1.1(transitive)
+ Addedinherits@2.0.4(transitive)
+ Addedis-my-ip-valid@1.0.1(transitive)
+ Addedis-my-json-valid@2.20.6(transitive)
+ Addedis-property@1.0.2(transitive)
+ Addedis-typedarray@1.0.0(transitive)
+ Addedisarray@1.0.0(transitive)
+ Addedisstream@0.1.2(transitive)
+ Addedjsbn@0.1.1(transitive)
+ Addedjson-schema@0.4.0(transitive)
+ Addedjsonpointer@5.0.1(transitive)
+ Addedjsprim@1.4.2(transitive)
+ Addedlodash@4.17.21(transitive)
+ Addedmime@1.3.6(transitive)
+ Addedmime-db@1.12.01.52.0(transitive)
+ Addedmime-types@2.0.142.1.35(transitive)
+ Addedoauth-sign@0.8.2(transitive)
+ Addedpinkie@2.0.4(transitive)
+ Addedpinkie-promise@2.0.1(transitive)
+ Addedprocess-nextick-args@1.0.7(transitive)
+ Addedpunycode@1.4.1(transitive)
+ Addedqs@6.2.4(transitive)
+ Addedreadable-stream@2.0.6(transitive)
+ Addedrequest@2.74.0(transitive)
+ Addedsafer-buffer@2.1.2(transitive)
+ Addedsntp@1.0.9(transitive)
+ Addedsshpk@1.18.0(transitive)
+ Addedstring_decoder@0.10.31(transitive)
+ Addedstrip-ansi@3.0.1(transitive)
+ Addedsupports-color@2.0.0(transitive)
+ Addedtough-cookie@2.3.4(transitive)
+ Addedtweetnacl@0.14.5(transitive)
+ Addedunirest@0.5.1(transitive)
+ Addedutil-deprecate@1.0.2(transitive)
+ Addedverror@1.10.0(transitive)
+ Addedxtend@4.0.2(transitive)
- Removedasn1@0.1.11(transitive)
- Removedassert-plus@0.1.5(transitive)
- Removedaws-sign2@0.5.0(transitive)
- Removedboom@0.4.2(transitive)
- Removedcryptiles@0.2.2(transitive)
- Removedctype@0.5.3(transitive)
- Removedforever-agent@0.5.2(transitive)
- Removedform-data@0.1.4(transitive)
- Removedhawk@1.1.1(transitive)
- Removedhoek@0.9.1(transitive)
- Removedhttp-signature@0.10.1(transitive)
- Removedlodash@2.4.2(transitive)
- Removedmime@1.2.11(transitive)
- Removedmime-types@1.0.2(transitive)
- Removedoauth-sign@0.3.0(transitive)
- Removedqs@1.0.2(transitive)
- Removedrequest@2.40.0(transitive)
- Removedshould@2.0.2(transitive)
- Removedsntp@0.2.4(transitive)
- Removedtldts@6.1.74(transitive)
- Removedtldts-core@6.1.74(transitive)
- Removedtough-cookie@5.1.0(transitive)
- Removedunirest@0.2.9(transitive)
Updatedasync@~2.0.1
Updatedlodash@^4.17.11
Updatedunirest@^0.5.1