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
Post a Comment