I've run into an issue while using angular-mock to inject my controller for unit testing. The error message I keep receiving is as follows:
[$injector:unpr] Unknown provider: PatientRecordsControllerProvider <- PatientRecordsController
This is how my code is set up -
(function () {
angular.module('patient_profile', ['ngRoute']);
})();
(function () {
var PatientRecordsController = function () {
};
angular.module('patient_profile').controller('PatientRecordsController', PatientRecordsController);
})();
Below is my test case snippet
describe('Unit Testing on PatientRecordsController', function () {
beforeEach(module('patient_profile'));
it('timeline should be an array', inject(['PatientRecordsController',
function (controller) {
//Unable to perform operations
}
]));
});
LATEST UPDATE: Interestingly, the method works flawlessly with services. Why is that?