here's my test code
var assert = require('assert');
allCards= require('../poker').allCards
describe('getEnemyCards() should return an array of enemy cards ',function(){
global.allCards=[["A-C",1],["4-D",1],["8-H",0],["9-S",1],["2-S",1],["7-H",1],["Q-S",1],["K-C",1]]
it('takes first 2 cards from allCards',function(){
assert.deepEqual(getEnemyCards(), ["A-C","4-D"])
});
});
And my poker.js code
module.exports.getEnemyCards=getEnemyCards
module.exports.allCards=allCards
var allCards = []
function getEnemyCards(){
//enemy cards check
var card1=allCards[0][0];
var card2=allCards[1][0];
return ([card1,card2]);
}
I tried changing allCards as shown but it remains [] how can i change it? Thanks.
Aucun commentaire:
Enregistrer un commentaire