Skip to content

Commit

Permalink
Rollback to forAllAsync
Browse files Browse the repository at this point in the history
  • Loading branch information
jkutianski committed Sep 19, 2015
1 parent 7bda4e4 commit 6fb062e
Showing 1 changed file with 20 additions and 15 deletions.
35 changes: 20 additions & 15 deletions test/testEndpoints.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@

console.log('NOTE: Don\'t abuse with the test, or your credentials will be throttled!!!');

var assert = require('assert');
var assert = require('assert'),
forAllAsync = require('forallasync').forAllAsync;

assert(process.env.MEETUP_KEY, 'MEETUP_KEY variable isn\'t set on enviroment (use \'set \"MEETUP_KEY=key\"\' on Windows)');

Expand Down Expand Up @@ -130,20 +131,24 @@ checkEndpoint.ws = function(endpointkey, cb) {
});
};

function* test(method) {
var protocol = (endpoints[method].resource.match(/^ws\:/)) ? 'ws' : 'http';
yield checkEndpoint[protocol](method, () => test(method).next);
console.log(method);
};


for (var method of meetup) {
if (endpoints[method].hasOwnProperty('test') && !endpoints[method].test.hasOwnProperty('disabled')) {
setTimeout(() => {
test(method).next();
}, 100);
}
}
var meetup_commands = (process.argv[2]) ? process.argv[2].split(',') : meetup.commands;

forAllAsync(meetup_commands
.filter(command => {
return endpoints[command].hasOwnProperty('test') &&
!endpoints[command].test.hasOwnProperty('disabled');
}),
(next, command) => {
if (endpoints[command].resource.match(/^ws\:/)) {
checkEndpoint.ws(command, next);
} else {
setTimeout(() => {
checkEndpoint.http(command, next);
}, 1000);
}
},
1
);

process.on('exit', function(code) {
if (!code) {
Expand Down

0 comments on commit 6fb062e

Please sign in to comment.