binions
Version:
A Javascript Poker game engine
38 lines (30 loc) • 1.22 kB
text/coffeescript
assert = require 'assert'
{Card} = require 'hoyle'
{Player} = require '../src/player'
describe "Basic player", ->
beforeEach ->
bot =
update: (game) -> 200
name = "Johnny Moss"
chips = 1000
= new Player(bot, chips, name)
it "should have a name", ->
assert.equal .name, 'Johnny Moss'
it "should be able to make a hand", ->
.cards = [new Card('As'), new Card('Kh')]
hand = .makeHand([new Card('Ah'), new Card('Ks'), new Card('Td')])
assert.equal hand.name, "Two pair"
describe "status", ->
it "should hide their cards during game play", ->
.cards = [new Card('As'), new Card('Kh')]
status = .status(Player.STATUS.PUBLIC)
assert.equal undefined, status.cards
it "should show their cards at the end", ->
.cards = [new Card('As'), new Card('Kh')]
status = .status(Player.STATUS.FINAL)
assert.equal 2,status.cards.length
it "should show their cards at the end unless they folded", ->
.cards = [new Card('As'), new Card('Kh')]
.state = 'folded'
status = .status(Player.STATUS.FINAL)
assert.equal undefined, status.cards