I've been working on incorporating a Jasmine test into my JavaScript program (which is just a game), but I'm running into an issue where new instances aren't being created. I'm hoping that someone could help me troubleshoot and identify the error.
'use strict';
describe('logic(bingo)',function() {
var bin
beforeEach(function() {
bin = new Bingo('Alex')
})
it('should throw error if name is not a string',function() {
bin = new Bingo()
expect(function() {
return bin.name
}).toThrowError('Input a string name')
})
it('should board.length===3 and board[0].length===5',function() {
expect(bin.board.length).toBe(3)
expect(bin.board[0].length).toBe(5)
})
}
For some reason, the variable "bin" isn't storing a "new Bingo" instance and remains undefined. The Bingo class is declared in a separate file and the links are correctly set up.
Thank you in advance for any assistance.