{"action":"closed","issue":{"url":"https://api.github.com/repos/karma-runner/karma/issues/3146","repository_url":"https://api.github.com/repos/karma-runner/karma","labels_url":"https://api.github.com/repos/karma-runner/karma/issues/3146/labels{/name}","comments_url":"https://api.github.com/repos/karma-runner/karma/issues/3146/comments","events_url":"https://api.github.com/repos/karma-runner/karma/issues/3146/events","html_url":"https://github.com/karma-runner/karma/issues/3146","id":364646537,"node_id":"MDU6SXNzdWUzNjQ2NDY1Mzc=","number":3146,"title":"Error: [$injector:unpr] Unknown provider: dataProvider <- data","user":{"login":"dmohan001c","id":10172893,"node_id":"MDQ6VXNlcjEwMTcyODkz","avatar_url":"https://avatars2.githubusercontent.com/u/10172893?v=4","gravatar_id":"","url":"https://api.github.com/users/dmohan001c","html_url":"https://github.com/dmohan001c","followers_url":"https://api.github.com/users/dmohan001c/followers","following_url":"https://api.github.com/users/dmohan001c/following{/other_user}","gists_url":"https://api.github.com/users/dmohan001c/gists{/gist_id}","starred_url":"https://api.github.com/users/dmohan001c/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dmohan001c/subscriptions","organizations_url":"https://api.github.com/users/dmohan001c/orgs","repos_url":"https://api.github.com/users/dmohan001c/repos","events_url":"https://api.github.com/users/dmohan001c/events{/privacy}","received_events_url":"https://api.github.com/users/dmohan001c/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-09-27T20:45:38Z","updated_at":"2018-09-27T23:31:14Z","closed_at":"2018-09-27T23:31:14Z","author_association":"NONE","body":"I am trying to write some unit test for my app, but I am running into an issue.\r\n\r\nMy .js file looks like\r\n`\r\nfunction () {\r\n\r\n    angular.module('app',[])\r\n        .factory('code', function ($http, svc, $q) {\r\n\r\n\t\t function getCodeByID(id) {\r\n                return $http.get(svc.get('my-application') + id)\r\n                    .then(function (res) {\r\n                        return res;\r\n                    });\r\n            }\r\n\r\n        function getCodes(query) {\r\n            var qry = ccUtils.buildQuery(query);\r\n            return $http.get(svc.get('url')\r\n                .then(function (response) {\r\n                    var resObj = {};\r\n                    resObj.data = response.data.content;\r\n                    resObj.pageData = {\r\n                        totalPages: response.data.totalPages,\r\n                        totalElements: response.data.totalElements\r\n                    };\r\n                    return resObj;\r\n                }));\r\n        }\r\n\t\t});\r\n\t})();\r\n`\r\nMy spec.js file looks like.\r\n`\r\n// testing controller\r\ndescribe('MyController', function() {\r\n   var data, svc, code;\r\n\r\n    // Set up the module\r\n    //beforeEach(module('app'));\r\n    beforeEach(angular.mock.module('app'));\r\n\r\n    beforeEach(inject(function(_data_) {\r\n        data = _data_;\r\n    }));\r\n\r\n    beforeEach(inject(function(_svc_) {\r\n        svc = _svc_;\r\n    }));\r\n\r\n    beforeEach(inject(function(_code_) {\r\n        code = _code_;\r\n    }));\r\n\r\n    it('Should exist', function() {\r\n        expect(code).toBeDefined();\r\n    });\r\n});\r\n`\r\nError\r\n`MyController\r\n    × Should exist\r\n        Error: [$injector:unpr] Unknown provider: dataProvider <- data\r\n        https://errors.angularjs.org/1.7.4/$injector/unpr?p0=dataProvider%20%3C-%20data\r\n            at node_modules/angular/angular.js:138:12\r\n            at node_modules/angular/angular.js:4905:19\r\n            at Object.getService [as get] (node_modules/angular/angular.js:5065:32)\r\n            at node_modules/angular/angular.js:4910:45\r\n            at getService (node_modules/angular/angular.js:5065:32)\r\n            at injectionArgs (node_modules/angular/angular.js:5090:58)\r\n            at Object.invoke (node_modules/angular/angular.js:5114:18)\r\n            at UserContext.WorkFn (node_modules/angular-mocks/angular-mocks.js:3439:20)\r\n        Error: Declaration Location\r\n            at window.inject.angular.mock.inject (node_modules/angular-mocks/angular-mocks.js:3402:25)\r\n            at Suite.<anonymous> (src/app/epcCodes/epc.spec.js:9:16)\r\n            at src/app/epcCodes/epc.spec.js:2:1\r\n`\r\nI have injected all the dependencies required for this code, still, I am running out of this issue. \r\nI am pretty new to unit testing, so any help with this would be appreciated."}}
{"actor":{"display_login":"johnjbarton"}}