javascript - Unit testing ext js with Jasmine 2.0 and PhantomJS -


i'm trying setup unit testing ext js application.
i'm using jasmine 2.0 , phantomjs run tests console.
can init store in init method of controller.
but, if try declare in stores config, i'm getting following error :
typeerror: 'null' not constructor (evaluating 'new c()') (line 1) (1) ,
cause error, , how can resolved?

thank in advance.

my code below:

testapplication.js

ext.loader.setconfig({ enabled: true }); ext.ns('myapp');  // loading different components controller, model, view.. ext.application({     name: 'myapp',     appfolder: '../app',     controllers: [],     autocreateviewport: false,      init : function() {         myapp.app = this;     },      // launch jasmine test environment     launch: function () {         var jasmineenv = jasmine.getenv();         jasmineenv.updateinterval = 1000;         var htmlreporter = new jasmine.htmlreporter();         jasmineenv.addreporter(htmlreporter);         jasmineenv.execute();     }  }); 

spec.js

describe("mycontroller", function () {     var ctrl= null,         store = null;      beforeeach(function () {         bmtab = ext.create("myapp.controller.mycontroller");         bmtab.init();     }); }); 

mycontroller.js

ext.define('myapp.controller.mycontroller', {     extend: 'ext.app.controller',      //stores: [stores.mystore];      init:function() {         console.log('**** init');         var store = ext.create(stores.mystore);          console.log('**** store created' + store);     }     }); 

the problem using jasmine 2.0, when of tutorials using jasmine 1.3.
in jasmine 2.0 file boot.js introduced.
, calling jasmine.getenv().execute() on window.onload.
because of that, specs executing before ext.launch called. once removed call execute() boot.js started working. below final version of testapplication.js code

p.s. note that, htmlreporter initialized in boot.js, there no need init on ext.launch function

ext.loader.setconfig({ enabled: true });  ext.application({     name: 'myapp',     appfolder: '../app',     controllers: [],     autocreateviewport: false,      // launch jasmine test environment     launch: function () {         var jasmineenv = jasmine.getenv();         jasmineenv.updateinterval = 1000;         jasmineenv.execute();     } }); 

Comments

Popular posts from this blog

java - Intellij Synchronizing output directories .. -

git - Initial Commit: "fatal: could not create leading directories of ..." -