Skip to content

Instantly share code, notes, and snippets.

@ionox0
Last active August 29, 2015 13:56
Show Gist options
  • Save ionox0/8963306 to your computer and use it in GitHub Desktop.
Save ionox0/8963306 to your computer and use it in GitHub Desktop.
exports.Card = function(suit,rank) {
function constructor() {};
constructor.prototype.getSuit = function() {
return suit; } ;
constructor.prototype.getRank = function() {
return rank; } ;
return new constructor();
}
var expect = require('chai').expect,
Card = require('../lib/card').Card;
describe('Card object tests', function(){
'use strict';
var card;
beforeEach(function(){
card = new Card('Hearts','8');
card.suit = 'spades';
card.rank = '4';
});
describe('constructor', function() {
it('card should be truthy (exists)', function(){
expect(card).to.be.ok;
});
it('card should have correct suit', function() {
expect(card.getSuit()).to.equal('Hearts');
});
it('card should have correct rank', function() {
expect(card.getRank()).to.equal('8');
});
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment