javascript - Jasmine how to test a file -


i've started testing jasmine-karma framework , confused. i'm trying test file called native.js. i've written test , i'm clueless causing test fail.

here's native.js file

    var goback = function() {     window.history.back(); };  document.addeventlistener("deviceready", ondeviceready, false);  function ondeviceready() {     navigator.splashscreen.hide()     return "now"; }  storage.prototype.setobject = function(key, value) {     this.setitem(key, json.stringify(value)); };  storage.prototype.getobject = function(key) {     var value = this.getitem(key);     return value && json.parse(value); }; 

here's unit testing ondeviceready() function: native.test.js:

describe("native.js", function() {   var ondeviceready = new ondeviceready();    it("return 2 when device ready", function() {   expect(ondeviceready()).toequal("now");   });  }); 


Comments

Popular posts from this blog

Android : Making Listview full screen -

javascript - Parse JSON from the body of the POST -

javascript - How to Hide Date Menu from Datepicker in yii2 -