{"action":"created","issue":{"url":"https://api.github.com/repos/angular-redux/store/issues/435","repository_url":"https://api.github.com/repos/angular-redux/store","labels_url":"https://api.github.com/repos/angular-redux/store/issues/435/labels{/name}","comments_url":"https://api.github.com/repos/angular-redux/store/issues/435/comments","events_url":"https://api.github.com/repos/angular-redux/store/issues/435/events","html_url":"https://github.com/angular-redux/store/issues/435","id":240890903,"number":435,"title":"About MockNgRedux","user":{"login":"gviligvili","id":8485006,"avatar_url":"https://avatars3.githubusercontent.com/u/8485006?v=3","gravatar_id":"","url":"https://api.github.com/users/gviligvili","html_url":"https://github.com/gviligvili","followers_url":"https://api.github.com/users/gviligvili/followers","following_url":"https://api.github.com/users/gviligvili/following{/other_user}","gists_url":"https://api.github.com/users/gviligvili/gists{/gist_id}","starred_url":"https://api.github.com/users/gviligvili/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gviligvili/subscriptions","organizations_url":"https://api.github.com/users/gviligvili/orgs","repos_url":"https://api.github.com/users/gviligvili/repos","events_url":"https://api.github.com/users/gviligvili/events{/privacy}","received_events_url":"https://api.github.com/users/gviligvili/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2017-07-06T09:06:40Z","updated_at":"2017-07-06T17:17:16Z","closed_at":null,"body":"### This is a...\r\n\r\n* [X ] usage question\r\n\r\n### What toolchain are you using for transpilation/bundling?\r\n\r\n* [X ] @angular/cli\r\n\r\nIn my test suit : \r\n\r\n\r\n```\r\nbeforeEach(() => {\r\n\r\n TestBed.configureTestingModule({\r\n            imports: [\r\n                HttpModule,\r\n                NgReduxTestingModule\r\n            ],\r\n            providers: [\r\n                MockBackend,\r\n                BaseRequestOptions,\r\n                {\r\n                    provide: Http,\r\n                    useFactory: (mockBackend, options) => {\r\n                        return new Http(mockBackend, options);\r\n                    },\r\n                    deps: [MockBackend, BaseRequestOptions]\r\n                },\r\n                ArticlesActions\r\n            ]\r\n        });\r\n\r\n        MockNgRedux.reset();\r\n    });\r\n```\r\n\r\nIn a test suite, I use a spy this way : \r\n`        var funcSpy = spy(MockNgRedux.getInstance(), \"dispatch\");\r\n`\r\n\r\nIn the second test, when I try to use a spy again - it says that the spy already exists.\r\n`TypeError: Attempted to wrap dispatch which is already wrapped`\r\nso besides doing some clearing logics in MockNgRedux.reset(), shouldn't it also clear the object himself?\r\n\r\nThink about it, in large applications, if a teammate wont clear the spy out of \"mockNgRedux.dispatch\",  it will be horrible to find it.\r\n\r\nIf I'm doing something wrong, please guide me :)\r\nThanks !"},"comment":{"url":"https://api.github.com/repos/angular-redux/store/issues/comments/313461293","html_url":"https://github.com/angular-redux/store/issues/435#issuecomment-313461293","issue_url":"https://api.github.com/repos/angular-redux/store/issues/435","id":313461293,"user":{"login":"e-schultz","id":3045906,"avatar_url":"https://avatars2.githubusercontent.com/u/3045906?v=3","gravatar_id":"","url":"https://api.github.com/users/e-schultz","html_url":"https://github.com/e-schultz","followers_url":"https://api.github.com/users/e-schultz/followers","following_url":"https://api.github.com/users/e-schultz/following{/other_user}","gists_url":"https://api.github.com/users/e-schultz/gists{/gist_id}","starred_url":"https://api.github.com/users/e-schultz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/e-schultz/subscriptions","organizations_url":"https://api.github.com/users/e-schultz/orgs","repos_url":"https://api.github.com/users/e-schultz/repos","events_url":"https://api.github.com/users/e-schultz/events{/privacy}","received_events_url":"https://api.github.com/users/e-schultz/received_events","type":"User","site_admin":false},"created_at":"2017-07-06T17:17:16Z","updated_at":"2017-07-06T17:17:16Z","body":"Hi,\r\n\r\nI'll take a look into this and see if it's something that `reset` can clean up automatically. According to the Jasmine docs - spies should clean up after each `it` block on it's own.\r\n\r\nIn the meantime, could something like:\r\n\r\n```js\r\nbeforeEach(function () {\r\n  this._originalMethod = obj.prototype.method;\r\n  spyOn(obj.prototype, 'method');\r\n});\r\n\r\nafterEach(function () {\r\n  obj.prototype.method = this._originalMethod;\r\n});\r\n```\r\n\r\nwork - came across this suggestion in the [jasmine issues](https://github.com/jasmine/jasmine/issues/236) \r\n\r\nThanks for bringing this to my attention though, I will try to look into it soon.\r\n\r\n"}}
{"actor":{"display_login":"e-schultz"}}