Skip to content

Commit

Permalink
added logWin & logVote
Browse files Browse the repository at this point in the history
  • Loading branch information
abarnhard committed Oct 13, 2014
1 parent 967238e commit 65cbedc
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 1 deletion.
33 changes: 33 additions & 0 deletions db/decks.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,39 @@
],
"answers" : [
{"_id" : {"$oid":"100000000000000000000001"},"id":1,"cardType":"A","text":"Flying sex snakes.","numAnswers":0,"expansion": "base"},
{"_id" : {"$oid":"100000000000000000000001"},"id":1,"cardType":"A","text":"Flying sex snakes.","numAnswers":0,"expansion": "base"},
{"_id" : {"$oid":"100000000000000000000001"},"id":1,"cardType":"A","text":"Flying sex snakes.","numAnswers":0,"expansion": "base"},
{"_id" : {"$oid":"100000000000000000000001"},"id":1,"cardType":"A","text":"Flying sex snakes.","numAnswers":0,"expansion": "base"},
{"_id" : {"$oid":"100000000000000000000001"},"id":1,"cardType":"A","text":"Flying sex snakes.","numAnswers":0,"expansion": "base"},
{"_id" : {"$oid":"100000000000000000000001"},"id":1,"cardType":"A","text":"Flying sex snakes.","numAnswers":0,"expansion": "base"},
{"_id" : {"$oid":"100000000000000000000001"},"id":1,"cardType":"A","text":"Flying sex snakes.","numAnswers":0,"expansion": "base"},
{"_id" : {"$oid":"100000000000000000000001"},"id":1,"cardType":"A","text":"Flying sex snakes.","numAnswers":0,"expansion": "base"},
{"_id" : {"$oid":"100000000000000000000001"},"id":1,"cardType":"A","text":"Flying sex snakes.","numAnswers":0,"expansion": "base"},
{"_id" : {"$oid":"100000000000000000000001"},"id":1,"cardType":"A","text":"Flying sex snakes.","numAnswers":0,"expansion": "base"},
{"_id" : {"$oid":"100000000000000000000001"},"id":1,"cardType":"A","text":"Flying sex snakes.","numAnswers":0,"expansion": "base"},
{"_id" : {"$oid":"100000000000000000000001"},"id":1,"cardType":"A","text":"Flying sex snakes.","numAnswers":0,"expansion": "base"},
{"_id" : {"$oid":"100000000000000000000002"},"id":2,"cardType":"A","text":"Michelle Obama's arms.","numAnswers":0,"expansion": "base"},
{"_id" : {"$oid":"100000000000000000000003"},"id":3,"cardType":"A","text":"German dungeon porn.","numAnswers":0,"expansion": "e2"},
{"_id" : {"$oid":"100000000000000000000002"},"id":2,"cardType":"A","text":"Michelle Obama's arms.","numAnswers":0,"expansion": "base"},
{"_id" : {"$oid":"100000000000000000000003"},"id":3,"cardType":"A","text":"German dungeon porn.","numAnswers":0,"expansion": "e2"},
{"_id" : {"$oid":"100000000000000000000002"},"id":2,"cardType":"A","text":"Michelle Obama's arms.","numAnswers":0,"expansion": "base"},
{"_id" : {"$oid":"100000000000000000000003"},"id":3,"cardType":"A","text":"German dungeon porn.","numAnswers":0,"expansion": "e2"},
{"_id" : {"$oid":"100000000000000000000002"},"id":2,"cardType":"A","text":"Michelle Obama's arms.","numAnswers":0,"expansion": "base"},
{"_id" : {"$oid":"100000000000000000000003"},"id":3,"cardType":"A","text":"German dungeon porn.","numAnswers":0,"expansion": "e2"},
{"_id" : {"$oid":"100000000000000000000002"},"id":2,"cardType":"A","text":"Michelle Obama's arms.","numAnswers":0,"expansion": "base"},
{"_id" : {"$oid":"100000000000000000000003"},"id":3,"cardType":"A","text":"German dungeon porn.","numAnswers":0,"expansion": "e2"},
{"_id" : {"$oid":"100000000000000000000002"},"id":2,"cardType":"A","text":"Michelle Obama's arms.","numAnswers":0,"expansion": "base"},
{"_id" : {"$oid":"100000000000000000000003"},"id":3,"cardType":"A","text":"German dungeon porn.","numAnswers":0,"expansion": "e2"},
{"_id" : {"$oid":"100000000000000000000002"},"id":2,"cardType":"A","text":"Michelle Obama's arms.","numAnswers":0,"expansion": "base"},
{"_id" : {"$oid":"100000000000000000000003"},"id":3,"cardType":"A","text":"German dungeon porn.","numAnswers":0,"expansion": "e2"},
{"_id" : {"$oid":"100000000000000000000002"},"id":2,"cardType":"A","text":"Michelle Obama's arms.","numAnswers":0,"expansion": "base"},
{"_id" : {"$oid":"100000000000000000000003"},"id":3,"cardType":"A","text":"German dungeon porn.","numAnswers":0,"expansion": "e2"},
{"_id" : {"$oid":"100000000000000000000002"},"id":2,"cardType":"A","text":"Michelle Obama's arms.","numAnswers":0,"expansion": "base"},
{"_id" : {"$oid":"100000000000000000000003"},"id":3,"cardType":"A","text":"German dungeon porn.","numAnswers":0,"expansion": "e2"},
{"_id" : {"$oid":"100000000000000000000002"},"id":2,"cardType":"A","text":"Michelle Obama's arms.","numAnswers":0,"expansion": "base"},
{"_id" : {"$oid":"100000000000000000000003"},"id":3,"cardType":"A","text":"German dungeon porn.","numAnswers":0,"expansion": "e2"},
{"_id" : {"$oid":"100000000000000000000002"},"id":2,"cardType":"A","text":"Michelle Obama's arms.","numAnswers":0,"expansion": "base"},
{"_id" : {"$oid":"100000000000000000000003"},"id":3,"cardType":"A","text":"German dungeon porn.","numAnswers":0,"expansion": "e2"},
{"_id" : {"$oid":"100000000000000000000002"},"id":2,"cardType":"A","text":"Michelle Obama's arms.","numAnswers":0,"expansion": "base"},
{"_id" : {"$oid":"100000000000000000000003"},"id":3,"cardType":"A","text":"German dungeon porn.","numAnswers":0,"expansion": "e2"},
{"_id" : {"$oid":"100000000000000000000008"},"id":8,"cardType":"A","text":"Two midgets shitting into a bucket.","numAnswers":0,"expansion": "hipster"}
Expand Down
34 changes: 33 additions & 1 deletion test/unit/game.js
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ describe('Game', function(){
expect(numCards).to.equal(1);
expect(players).to.have.length(1);
expect(cards).to.have.length(1);
expect(deck.answers).to.have.length(3);
expect(deck.answers).to.have.length(36);
done();
});
});
Expand Down Expand Up @@ -263,6 +263,38 @@ describe('Game', function(){
});
});

describe('.dealHand', function(){
it('should return 10 cards for each player and all players in the game', function(done){
Game.dealHand('200000000000000000000005', function(err, players, cards){
expect(players).to.have.length(2);
expect(cards).to.have.length(20);
done();
});
});
});

describe('.logWin', function(){
it('should increase a players wins in the gamedata object', function(done){
Game.logWin('200000000000000000000005', 'john', function(err, count){
Game.findById('200000000000000000000005', function(err, g){
expect(g.gameData.john.wins).to.equal(1);
done();
});
});
});
});

describe('.logVote', function(){
it('should add the players name to the end game votes array', function(done){
Game.logVote('200000000000000000000005', 'john', function(err, count){
Game.findById('200000000000000000000005', function(err, g){
expect(g.endGameVotes).to.have.length(1);
done();
});
});
});
});

});

/*
Expand Down

0 comments on commit 65cbedc

Please sign in to comment.