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

windows - Single EXE to Install Python Standalone Executable for Easy Distribution -

c# - Access objects in UserControl from MainWindow in WPF -

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