javascript - Unit Test AngularJS service -


i have below angularjs service class, how can write jasmine unit test class service?

quoteapp.service('travelinfoservice', function() {     this.travelareatest = function() {         return 'testval';     };     this.travelareadiasbled = function(currenttriptype) {         if (currenttriptype.substring(0, 4) == 'sing') {             return true;         } else {             return false;         }     }; }); 

unit test class

describe('sample test', function() {  var travelinfoservice = null;    beforeeach(module('quoteapp'));    beforeeach(inject(function(travelinfoservice) {   scope = $rootscope.$new();   travelinfoservice = travelinfoservice;  }));   it('should not false', function() {   expect(travelinfoservice.travelareatest()).toequal(false); });  }); 

this unit-test class not working need correct it.


Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -