requirejs - How to use Jasmine to test if an instance is created? -


hi new using jasmine. issue follows: have number of modules, managed through requirejs. module creates instance of module b in it. possible use jasmine test whether instance of b being created in a? convey clearer idea of code, have:

             //in module               define(['b',],function(b){                  function test(){                     var newtest = new b();                  };                  return {test: test};               }); 

now, how use jasmine test module indeed, creates instance of module b? in advance!

regards

here's 1 way check type of object in jasmine test:

describe('chocolatefactory', function() {     it('creates instance of chocolate', function() {         var factory = new chocolatefactory();         var chocolate = factory.makechocolate();         expect(chocolate instanceof chocolate).tobe(true);     }); }); 

Comments

Popular posts from this blog

javascript - How to name a jQuery function to make a browser's back button work? -

collision detection - C++ library for mesh to mesh intersection: what is available? -

python - Django-easy-pdf: xhtml2pdf reporting reportlab 2.2+ is required, but 3.0 installed -