Skip to content

Commit

Permalink
Modeified getList test
Browse files Browse the repository at this point in the history
  • Loading branch information
philliphenslee committed Oct 22, 2015
1 parent 127d91c commit 50f67b1
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 8 deletions.
8 changes: 4 additions & 4 deletions lib/slack/users.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ module.exports = {

api.post('users.list', params, function (err, result) {
if (err) {
return callback(err, null);
return callback(err);
}
cache.data.users = result.members;
callback(null, result);
Expand All @@ -135,7 +135,7 @@ module.exports = {

api.post('users.getPresence', { user: user }, function (err, result) {
if (err) {
return callback(err, null);
return callback(err);
}
callback(null, result);
});
Expand All @@ -152,7 +152,7 @@ module.exports = {

api.post('users.info', function (err, result) {
if (err) {
return callback(err, null);
return callback(err);
}
callback(null, result);
});
Expand All @@ -173,7 +173,7 @@ module.exports = {

api.post('users.setPresence', { presence: presence }, function (err, result) {
if (err) {
return callback(err, null);
return callback(err);
}
callback(null, result);
});
Expand Down
18 changes: 14 additions & 4 deletions lib/slack/users.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,10 +102,6 @@ describe('users', function () {

it('should open channel by id if not found in cache', function (done) {

before(function () {
cache.ims = null;
});

var scope = nock('https://slack.com')
.post('/api/im.open')
.reply(200, { ok: true, channel: { id: "D024BFF1M" } });
Expand Down Expand Up @@ -137,6 +133,20 @@ describe('users', function () {
done();
});

it('should open channel by id if not found in cache', function (done) {

var scope = nock('https://slack.com')
.post('/api/users.list')
.reply(200, { ok: true });

users.getList(true, function (err, result) {
expect(result).to.be.an('object');
expect(result.ok).to.equal(true);
done();
});

});

});
// function get(name, callback)
describe('#getPresence', function () {
Expand Down

0 comments on commit 50f67b1

Please sign in to comment.