{"action":"created","issue":{"url":"https://api.github.com/repos/laurelnaiad/angular-couch-potato/issues/1","labels_url":"https://api.github.com/repos/laurelnaiad/angular-couch-potato/issues/1/labels{/name}","comments_url":"https://api.github.com/repos/laurelnaiad/angular-couch-potato/issues/1/comments","events_url":"https://api.github.com/repos/laurelnaiad/angular-couch-potato/issues/1/events","html_url":"https://github.com/laurelnaiad/angular-couch-potato/issues/1","id":18329720,"number":1,"title":"testing","user":{"login":"laurelnaiad","id":4078946,"avatar_url":"https://avatars.githubusercontent.com/u/4078946?v=3","gravatar_id":"","url":"https://api.github.com/users/laurelnaiad","html_url":"https://github.com/laurelnaiad","followers_url":"https://api.github.com/users/laurelnaiad/followers","following_url":"https://api.github.com/users/laurelnaiad/following{/other_user}","gists_url":"https://api.github.com/users/laurelnaiad/gists{/gist_id}","starred_url":"https://api.github.com/users/laurelnaiad/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/laurelnaiad/subscriptions","organizations_url":"https://api.github.com/users/laurelnaiad/orgs","repos_url":"https://api.github.com/users/laurelnaiad/repos","events_url":"https://api.github.com/users/laurelnaiad/events{/privacy}","received_events_url":"https://api.github.com/users/laurelnaiad/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/laurelnaiad/angular-couch-potato/labels/qa","name":"qa","color":"eb6420"}],"state":"open","locked":false,"assignee":{"login":"laurelnaiad","id":4078946,"avatar_url":"https://avatars.githubusercontent.com/u/4078946?v=3","gravatar_id":"","url":"https://api.github.com/users/laurelnaiad","html_url":"https://github.com/laurelnaiad","followers_url":"https://api.github.com/users/laurelnaiad/followers","following_url":"https://api.github.com/users/laurelnaiad/following{/other_user}","gists_url":"https://api.github.com/users/laurelnaiad/gists{/gist_id}","starred_url":"https://api.github.com/users/laurelnaiad/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/laurelnaiad/subscriptions","organizations_url":"https://api.github.com/users/laurelnaiad/orgs","repos_url":"https://api.github.com/users/laurelnaiad/repos","events_url":"https://api.github.com/users/laurelnaiad/events{/privacy}","received_events_url":"https://api.github.com/users/laurelnaiad/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/laurelnaiad/angular-couch-potato/milestones/1","labels_url":"https://api.github.com/repos/laurelnaiad/angular-couch-potato/milestones/1/labels","id":406688,"number":1,"title":"1.0","description":null,"creator":{"login":"laurelnaiad","id":4078946,"avatar_url":"https://avatars.githubusercontent.com/u/4078946?v=3","gravatar_id":"","url":"https://api.github.com/users/laurelnaiad","html_url":"https://github.com/laurelnaiad","followers_url":"https://api.github.com/users/laurelnaiad/followers","following_url":"https://api.github.com/users/laurelnaiad/following{/other_user}","gists_url":"https://api.github.com/users/laurelnaiad/gists{/gist_id}","starred_url":"https://api.github.com/users/laurelnaiad/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/laurelnaiad/subscriptions","organizations_url":"https://api.github.com/users/laurelnaiad/orgs","repos_url":"https://api.github.com/users/laurelnaiad/repos","events_url":"https://api.github.com/users/laurelnaiad/events{/privacy}","received_events_url":"https://api.github.com/users/laurelnaiad/received_events","type":"User","site_admin":false},"open_issues":1,"closed_issues":0,"state":"open","created_at":"2013-08-21T00:22:32Z","updated_at":"2013-08-21T00:22:32Z","due_on":null,"closed_at":null},"comments":12,"created_at":"2013-08-21T00:22:32Z","updated_at":"2015-02-10T13:04:01Z","closed_at":null,"body":"see https://github.com/afterglowtech/angular-couchPotato/issues/2 ... need to establish tests for couch-potato as well as guide for testing apps that use couch-potoato."},"comment":{"url":"https://api.github.com/repos/laurelnaiad/angular-couch-potato/issues/comments/73695565","html_url":"https://github.com/laurelnaiad/angular-couch-potato/issues/1#issuecomment-73695565","issue_url":"https://api.github.com/repos/laurelnaiad/angular-couch-potato/issues/1","id":73695565,"user":{"login":"jorisvddonk","id":266543,"avatar_url":"https://avatars.githubusercontent.com/u/266543?v=3","gravatar_id":"","url":"https://api.github.com/users/jorisvddonk","html_url":"https://github.com/jorisvddonk","followers_url":"https://api.github.com/users/jorisvddonk/followers","following_url":"https://api.github.com/users/jorisvddonk/following{/other_user}","gists_url":"https://api.github.com/users/jorisvddonk/gists{/gist_id}","starred_url":"https://api.github.com/users/jorisvddonk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jorisvddonk/subscriptions","organizations_url":"https://api.github.com/users/jorisvddonk/orgs","repos_url":"https://api.github.com/users/jorisvddonk/repos","events_url":"https://api.github.com/users/jorisvddonk/events{/privacy}","received_events_url":"https://api.github.com/users/jorisvddonk/received_events","type":"User","site_admin":false},"created_at":"2015-02-10T13:04:01Z","updated_at":"2015-02-10T13:04:01Z","body":"I think I've found a way to make unit tests work: by making your RequireJS modules (e.g. the services/controllers you create) return arrays and getting instances of the required services/components via $injector.invoke(...):\r\n\r\nIn path/to/myService.js:\r\n\r\n    define(['app'], function(app){\r\n        \"use strict\";\r\n\r\n        var serviceDefinition = ['$q', function($q) {\r\n            var mValue = \"Some value for this example service\";\r\n\r\n            return {\r\n                setValue: function(val) {\r\n                    mValue = val;\r\n                },\r\n                getValue: function() {\r\n                    return mValue;\r\n                },\r\n                getValueAsPromise: function() {\r\n                    var deferred = $q.defer();\r\n                    deferred.resolve(mValue);\r\n                    return deferred.promise;\r\n                }\r\n            };\r\n\r\n        }];\r\n\r\n        app.registerService('myService', serviceDefinition); // works also with app.service('myService', serviceDefinition)\r\n        return serviceDefinition;\r\n    })\r\n\r\nIn test.js:\r\n\r\n    define(['angular', 'app', ..., 'path/to/myService'], function(angular, app, ..., myServiceDefinition) {\r\n        describe('myService', function() {\r\n          var myService;\r\n          beforeEach(angular.mock.module({'app': app}));\r\n          beforeEach(angular.mock.inject(function ($injector) {\r\n            myService = $injector.invoke(myServiceDefinition);\r\n          }));\r\n          it ('should do something', function() {\r\n            //Test myService here\r\n          });\r\n        });\r\n    });\r\n\r\nHaven't had enough time yet to figure out if this covers all cases and works properly in all situations, but at least I seem to be able to create *some* tests using this mechanism, rather than having no luck at all as was the case earlier."}}