From eadb8f3b12b1a4190315dec25c6ea3b55485e242 Mon Sep 17 00:00:00 2001 From: Chris Blanchard Date: Fri, 28 Aug 2015 15:17:02 +0100 Subject: [PATCH] Fix user population method --- lib/gather/helper.js | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/lib/gather/helper.js b/lib/gather/helper.js index d53a8c8..d612389 100644 --- a/lib/gather/helper.js +++ b/lib/gather/helper.js @@ -3,27 +3,18 @@ var User = require("../user/user"); var client = require("../ensl/client")(); var async = require("async"); +var getRandomUser = require("../user/helper").getRandomUser; var createTestUsers = (options, callback) => { var gather = options.gather; - var getRandomUser = callback => { - var id = Math.floor(Math.random() * 5000) + 1; - client.getUserById({ - id: id - }, (error, response, body) => { - if (response.statusCode !== 200) return getRandomUser(callback); - return callback(error, response, body); - }); - }; - var instructions = []; for (var i = 0; i < 11; i++) { instructions.push(callback => { - getRandomUser((error, response, body) => { + getRandomUser((error, user) => { if (error) return callback(error); if (gather.can("addGatherer")) { - gather.addGatherer(new User(body)); + gather.addGatherer(user); } callback(); });