samedi 28 mars 2015

testing for global variable in mocha js from node

I am new to js unit testing and I am trying to use mocha for my backbone contact manager. However, i have a global window.ContactManager variable that I want to test whether it exists. The variable looks like so:



window.ContactManager = {
Models: {},
Collections: {},
Views: {},
Routers: {}

start: function(data) {

}
}


My test that does not work: var expect = require ('chai').expect;



describe("Application", function() {
it('creates a global variable for the name space ContactManager' , function () {
expect(ContactManager).to.exist;
})
});


How do I test and access a global window variable existence in mocha from running the tests in the console?


Aucun commentaire:

Enregistrer un commentaire