mardi 4 août 2015

How statement is covered in Karma?

I am doing testing using karma tool. I am not able to covered code inside foreach statement. Please let me know how i can coverage this code using jasmine test case.

enter image description here

I have written below suite in jasmine for this.

 describe('Employee test', function () {
    beforeEach(() => {
        module('app');
        inject((_$controller_: ng.IControllerService, _$httpBackend_: ng.IHttpBackendService, $http: ng.IHttpService) => {

                httpB = _$httpBackend_;
                http = $http;
                empService = new EmployeeService($http);

                ctrl = $controller("employeeCtrl", { $scope: $scope, empService });
        });
    it("controller constructor",() => {
                empService.testdata = [];
                var ctrlObj = new employeeCtrlClass($scope, empService);
        });
     });

here , I am creating employeeCtrlClass object so that it is indirectly called the constructor of function. but it is not able to called foreach statement.

Aucun commentaire:

Enregistrer un commentaire