Skip to content

Commit

Permalink
Add test for .members
Browse files Browse the repository at this point in the history
  • Loading branch information
Chakrit Wichian committed Mar 1, 2013
1 parent 976eb74 commit 05aa683
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion test/groups-test.js
Expand Up @@ -13,7 +13,7 @@ var Tom = group('tom')


test('test all the things', function (t) { test('test all the things', function (t) {


t.plan(98) t.plan(100)


Tom.membership.add('anonymous', function (error, result) { Tom.membership.add('anonymous', function (error, result) {
t.deepEqual(error, null, 'error should be null') t.deepEqual(error, null, 'error should be null')
Expand Down Expand Up @@ -163,6 +163,10 @@ test('test all the things', function (t) {
t.deepEqual(result.sort(), [ 'javascript', 'nodejs', 'otherGroup', 'anonymous', 'admin', 'one', 'two' ].sort(), 'result should be the same') t.deepEqual(result.sort(), [ 'javascript', 'nodejs', 'otherGroup', 'anonymous', 'admin', 'one', 'two' ].sort(), 'result should be the same')
}) })


nodejs.members.has(javascript, function (error, result) {
t.notOk(result, 'result should be falsy')
})

nodejs.members.add(javascript, function (error, result) { nodejs.members.add(javascript, function (error, result) {
t.deepEqual(error, null, 'error should be null') t.deepEqual(error, null, 'error should be null')
t.deepEqual(result, [ 1, 1 ], 'result should be the same') t.deepEqual(result, [ 1, 1 ], 'result should be the same')
Expand All @@ -172,6 +176,10 @@ test('test all the things', function (t) {
}) })
}) })


nodejs.members.has(javascript, function (error, result) {
t.ok(result, 'result should be truthy')
})

javascript.members.all(function (error, result) { javascript.members.all(function (error, result) {
t.deepEqual(error, null, 'error should be null') t.deepEqual(error, null, 'error should be null')
t.deepEqual(result.sort(), [ 'tom', 'bob', 'bill' ].sort(), 'result should be the same') t.deepEqual(result.sort(), [ 'tom', 'bob', 'bill' ].sort(), 'result should be the same')
Expand Down

0 comments on commit 05aa683

Please sign in to comment.