Skip to content
This repository has been archived by the owner on Nov 13, 2017. It is now read-only.

Commit

Permalink
Fixing getBadges test to allow for search
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewhayward committed Jun 20, 2013
1 parent bb0d076 commit 6e446e9
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions test/openbadger.test.js
Expand Up @@ -137,10 +137,11 @@ test('getBadge', function(t) {
});

test('getBadges', function(t){
const CALLBACK_INDEX = 2;

t.test('on error', function(t) {
var getStub = mock.expects('get');
getStub.callsArgWith(1, 500, 'error of some sort');
getStub.callsArgWith(CALLBACK_INDEX, 500, 'error of some sort');
openbadger.getBadges(DEFAULT_QUERY, function(err, data) {
t.same(err, 500, 'error');
t.same(data, 'error of some sort', 'data');
Expand All @@ -150,7 +151,7 @@ test('getBadges', function(t){

t.test('with data', function(t) {
var getStub = mock.expects('get');
getStub.callsArgWith(1, null, DATA['badges']);
getStub.callsArgWith(CALLBACK_INDEX, null, DATA['badges']);
openbadger.getBadges(DEFAULT_QUERY, function(err, data) {
t.notOk(err, 'no error');
t.same(data.badges.length, 3, 'data length');
Expand All @@ -163,7 +164,7 @@ test('getBadges', function(t){

t.test('paginates', function(t) {
var getStub = mock.expects('get');
getStub.callsArgWith(1, null, DATA['badges']);
getStub.callsArgWith(CALLBACK_INDEX, null, DATA['badges']);
openbadger.getBadges({ pageSize: 2, page: 1 }, function(err, data) {
t.notOk(err, 'no error');
t.same(data.badges.length, 2, 'paginated');
Expand Down

0 comments on commit 6e446e9

Please sign in to comment.