vendredi 22 juillet 2016

AngularJs Unit Test Jamine: ReferenceError: PagePath is not defined

I am getting the error.

ReferenceError: PagePath is not defined

My code is as follows:-

describe('Patient Defect Management', function () {

beforeEach(module('myApp'));
var $controller;
var $httpBackend;
var myService;

beforeEach(inject(function (_$controller_) {
    $controller = _$controller_;
}));

beforeEach(inject(function ($injector) {

    $httpBackend = $injector.get("$httpBackend");
    myService = $injector.get("angularService");


}));

afterEach(function() {
    $httpBackend.verifyNoOutstandingExpectation();
    $httpBackend.verifyNoOutstandingRequest();

});

it('NextAccountDetails', function () {

    var $scope = {};
    var controller = $controller('PatientDefectManagementCtrl', { $scope: $scope });
    var returnData = {"FacilityCode": "ABCD", "ID": "1540447"};
    $httpBackend.expectGET("http://localhost:8081/Accretive.Tasks.PatientDefectManagement/Services/PatientManagement.asmx/GetDetails").respond(returnData);

    var returnedPromise = myService.get('1234', 'test');
    var result;
    returnedPromise.then(function (response) {
        result = response.data;
    });

    expect(result).toEqual(returnData);
    $httpBackend.flush();
});

Please tell why I am getting this error, where should I make change in my code, to remove this error.

Thanks,

Aucun commentaire:

Enregistrer un commentaire