diff --git a/test/api/status/status-get.js b/test/api/status/status-get.js index 9b9762c250..f4687b64be 100644 --- a/test/api/status/status-get.js +++ b/test/api/status/status-get.js @@ -10,8 +10,7 @@ describe('Status', () => { it('returns a status of up when server is up', (done) => { api.get('/status') .then((res) => { - expect(res.code).to.eql(200); - expect(res.body.status).to.eql('up'); + expect(res.status).to.eql('up'); done(); }) .catch((err) => { diff --git a/test/helpers/api.helper.js b/test/helpers/api.helper.js index becc2f6274..da1cf28075 100644 --- a/test/helpers/api.helper.js +++ b/test/helpers/api.helper.js @@ -1,5 +1,7 @@ import superagent from 'superagent'; +const API_TEST_SERVER_PORT = 3003; + export function requester(user={}) { return { get: _requestMaker(user, 'get'), @@ -10,9 +12,9 @@ export function requester(user={}) { } function _requestMaker(user, method) { - return (route, options={}) => { + return (route, send, query) => { return new Promise((resolve, reject) => { - let request = superagent[method](`http://localhost:3003/api/v2${route}`) + let request = superagent[method](`http://localhost:${API_TEST_SERVER_PORT}/api/v2${route}`) .accept('application/json'); if (user._id && user.apiToken) { @@ -22,17 +24,12 @@ function _requestMaker(user, method) { } request - .query(options.query) - .send(options.send) + .query(query) + .send(send) .end((err, response) => { if (err) { return reject(err); } - let res = { - code: response.statusCode, - body: response.body, - } - - resolve(res); + resolve(response.body); }); }); }