{"action":"closed","issue":{"url":"https://api.github.com/repos/EventMobi/angular-easy-test/issues/1","labels_url":"https://api.github.com/repos/EventMobi/angular-easy-test/issues/1/labels{/name}","comments_url":"https://api.github.com/repos/EventMobi/angular-easy-test/issues/1/comments","events_url":"https://api.github.com/repos/EventMobi/angular-easy-test/issues/1/events","html_url":"https://github.com/EventMobi/angular-easy-test/issues/1","id":52156989,"number":1,"title":"mockModule provide API","user":{"login":"dmkc","id":118149,"avatar_url":"https://avatars.githubusercontent.com/u/118149?v=3","gravatar_id":"","url":"https://api.github.com/users/dmkc","html_url":"https://github.com/dmkc","followers_url":"https://api.github.com/users/dmkc/followers","following_url":"https://api.github.com/users/dmkc/following{/other_user}","gists_url":"https://api.github.com/users/dmkc/gists{/gist_id}","starred_url":"https://api.github.com/users/dmkc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dmkc/subscriptions","organizations_url":"https://api.github.com/users/dmkc/orgs","repos_url":"https://api.github.com/users/dmkc/repos","events_url":"https://api.github.com/users/dmkc/events{/privacy}","received_events_url":"https://api.github.com/users/dmkc/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/EventMobi/angular-easy-test/labels/enhancement","name":"enhancement","color":"84b6eb"}],"state":"closed","locked":false,"assignee":{"login":"elvinyung","id":7042541,"avatar_url":"https://avatars.githubusercontent.com/u/7042541?v=3","gravatar_id":"","url":"https://api.github.com/users/elvinyung","html_url":"https://github.com/elvinyung","followers_url":"https://api.github.com/users/elvinyung/followers","following_url":"https://api.github.com/users/elvinyung/following{/other_user}","gists_url":"https://api.github.com/users/elvinyung/gists{/gist_id}","starred_url":"https://api.github.com/users/elvinyung/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/elvinyung/subscriptions","organizations_url":"https://api.github.com/users/elvinyung/orgs","repos_url":"https://api.github.com/users/elvinyung/repos","events_url":"https://api.github.com/users/elvinyung/events{/privacy}","received_events_url":"https://api.github.com/users/elvinyung/received_events","type":"User","site_admin":false},"milestone":null,"comments":3,"created_at":"2014-12-16T19:38:01Z","updated_at":"2015-03-17T15:57:05Z","closed_at":"2015-03-17T15:57:05Z","body":"Oh hi!\r\n\r\nSo, we talked about supplying hashes to `mockModule` instead of arrays but what I've realized is that sometimes you want to provide something other than a factory. `$provide` is able to mock out more than factories: https://docs.angularjs.org/api/auto/service/$provide\r\n\r\nThe current `provider` syntax is technically a misnomer. E.g. \r\n```javascript\r\nEasyTest.mockModule('blah', [{ name: 'SomeService',  provider: myService }])\r\n```\r\nis actually calling `$provide.factory`, not `$provide.provider`. I propose the following changes: first, extend the current API to be able to mock out whatever `$provide` is able to:\r\n\r\n```javascript\r\n// Mock out a factory\r\nEasyTest.mockModule('blah', [{ name: 'SomeService',  factory: myService }])\r\n\r\n// Mock out a value\r\nEasyTest.mockModule('blah', [{ name: 'SomeValue',  value: myValue }])\r\n\r\n// Mock out a provider-provider, not a factory\r\nEasyTest.mockModule('blah', [{ name: 'SomeService',  provider: myService }])\r\n```\r\nThe latter case, specifically `$provide.value`, is what I needed to properly mock out `$q` using node's implementation, as it is not a factory but merely a straight-up library.\r\n\r\nIn addition to that, and assuming that factories are the most common use case (I don't know if they are), we can let the library take a hash instead:\r\n```javascript\r\n// Take a hash of factories\r\nEasyTest.mockModule('myHotModule', {\r\n  'ServiceToMock': myMockService, \r\n  'AnotherService': anotherMock\r\n})\r\n```\r\nwhich will be equivalent to using `factory: myMockService`, or `$provide.factory` under the hood.\r\n\r\nWhatcha think?\r\n"}}