Last active
August 29, 2015 13:56
-
-
Save ionox0/8963306 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
exports.Card = function(suit,rank) { | |
function constructor() {}; | |
constructor.prototype.getSuit = function() { | |
return suit; } ; | |
constructor.prototype.getRank = function() { | |
return rank; } ; | |
return new constructor(); | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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