{"action":"created","issue":{"url":"https://api.github.com/repos/leoasis/redux-immutable-state-invariant/issues/9","repository_url":"https://api.github.com/repos/leoasis/redux-immutable-state-invariant","labels_url":"https://api.github.com/repos/leoasis/redux-immutable-state-invariant/issues/9/labels{/name}","comments_url":"https://api.github.com/repos/leoasis/redux-immutable-state-invariant/issues/9/comments","events_url":"https://api.github.com/repos/leoasis/redux-immutable-state-invariant/issues/9/events","html_url":"https://github.com/leoasis/redux-immutable-state-invariant/pull/9","id":138589656,"number":9,"title":"add stateInvariantTestHelper named export","user":{"login":"jebeck","id":1588547,"avatar_url":"https://avatars.githubusercontent.com/u/1588547?v=3","gravatar_id":"","url":"https://api.github.com/users/jebeck","html_url":"https://github.com/jebeck","followers_url":"https://api.github.com/users/jebeck/followers","following_url":"https://api.github.com/users/jebeck/following{/other_user}","gists_url":"https://api.github.com/users/jebeck/gists{/gist_id}","starred_url":"https://api.github.com/users/jebeck/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jebeck/subscriptions","organizations_url":"https://api.github.com/users/jebeck/orgs","repos_url":"https://api.github.com/users/jebeck/repos","events_url":"https://api.github.com/users/jebeck/events{/privacy}","received_events_url":"https://api.github.com/users/jebeck/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2016-03-04T21:24:51Z","updated_at":"2016-03-09T20:34:24Z","closed_at":"2016-03-09T20:34:24Z","pull_request":{"url":"https://api.github.com/repos/leoasis/redux-immutable-state-invariant/pulls/9","html_url":"https://github.com/leoasis/redux-immutable-state-invariant/pull/9","diff_url":"https://github.com/leoasis/redux-immutable-state-invariant/pull/9.diff","patch_url":"https://github.com/leoasis/redux-immutable-state-invariant/pull/9.patch"},"body":"Hi again @leoasis. This is the PR I referenced in #8 - the real reason I cloned to work on something and noticed the failing tests.\r\n\r\nI first read about this project of yours in the redux docs, and recently it came up again for us at Tidepool. We don't particularly have a use for the middleware, but we *love* the ability to detect mutations recursively. We are quite obsessed with testing, and one of the things we test in all of our reducer tests is that we're not mutating the initial state (for any reducer that operates on a slice of state that's an object or array). So this PR adds a named export `stateInvariantTestHelper` providing an interface to track an initial state fixture (`trackObj`) in a test and then a function (`hasMutated`) to query for whether the object has been mutated at any level in a test expectation.\r\n\r\nWe use it like this:\r\n```\r\n    it('should not mutate object in handling SET_BLIP_VIEW_DATA_URL', () => {\r\n      let initialState = {};\r\n      const tracked = stateInvariantTestHelper.trackObj(initialState);\r\n      let finalState = misc.blipUrls(initialState, {\r\n        type: actionTypes.SET_BLIP_VIEW_DATA_URL,\r\n        payload: actionPayload\r\n      });\r\n      expect(stateInvariantTestHelper.hasMutated(tracked)).to.be.false;\r\n    });\r\n```\r\n\r\nBefore I go any further, I wanted to find out if this is a change/PR that interests you since obviously it expands the use cases that this repo would be supporting. If you are interested, I'm happy to discuss the particulars of the new export's interface (I'm not quite sure yet that it's ideal), add some tests, and update the README with the usage. If you're not interested, just let me know, and we at Tidepool will then probably change the name of our fork, remove the middleware-specific code, and publish to npm separately just with the test helper."},"comment":{"url":"https://api.github.com/repos/leoasis/redux-immutable-state-invariant/issues/comments/194495235","html_url":"https://github.com/leoasis/redux-immutable-state-invariant/pull/9#issuecomment-194495235","issue_url":"https://api.github.com/repos/leoasis/redux-immutable-state-invariant/issues/9","id":194495235,"user":{"login":"leoasis","id":328001,"avatar_url":"https://avatars.githubusercontent.com/u/328001?v=3","gravatar_id":"","url":"https://api.github.com/users/leoasis","html_url":"https://github.com/leoasis","followers_url":"https://api.github.com/users/leoasis/followers","following_url":"https://api.github.com/users/leoasis/following{/other_user}","gists_url":"https://api.github.com/users/leoasis/gists{/gist_id}","starred_url":"https://api.github.com/users/leoasis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/leoasis/subscriptions","organizations_url":"https://api.github.com/users/leoasis/orgs","repos_url":"https://api.github.com/users/leoasis/repos","events_url":"https://api.github.com/users/leoasis/events{/privacy}","received_events_url":"https://api.github.com/users/leoasis/received_events","type":"User","site_admin":false},"created_at":"2016-03-09T20:34:24Z","updated_at":"2016-03-09T20:34:24Z","body":"Closing, but feel free to comment further if you want!"}}