{"_id":"@asaayers/redux-saga-tester","_rev":"4-cf798a50984cdaa26a2bc718bb001818","name":"@asaayers/redux-saga-tester","description":"Test your sagas by intercepting effects","dist-tags":{"latest":"0.1.1"},"versions":{"0.1.0":{"name":"@asaayers/redux-saga-tester","version":"0.1.0","description":"Test your sagas by intercepting effects","main":"lib/index.js","dependencies":{},"devDependencies":{"babel-jest":"^15.0.0","babel-plugin-transform-es2015-spread":"^6.8.0","babel-plugin-transform-object-rest-spread":"^6.8.0","babel-polyfill":"^6.13.0","eslint":"^3.5.0","jest":"^15.1.1","redux":"^3.6.0","redux-saga":"^0.11.1"},"scripts":{"build":"BABEL_ENV=production babel src -d lib --ignore tests/","lint":"eslint src","test":"jest"},"files":["lib"],"repository":{"type":"git","url":"git+ssh://git@gitlab.com/AsaAyers/redux-saga-tester.git"},"author":{"name":"Asa Ayers","email":"Asa@AsaAyers.com"},"license":"ISC","bugs":{"url":"https://gitlab.com/AsaAyers/redux-saga-tester/issues"},"homepage":"https://gitlab.com/AsaAyers/redux-saga-tester#README","gitHead":"d4a61265fa220c72abbc591492061192beabea9d","_id":"@asaayers/redux-saga-tester@0.1.0","_shasum":"b4a70e1b76abdd8df437cbe6b8a0c5ae98640ee6","_from":".","_npmVersion":"3.8.3","_nodeVersion":"4.4.1","_npmUser":{"name":"asaayers","email":"Asa@AsaAyers.com"},"dist":{"shasum":"b4a70e1b76abdd8df437cbe6b8a0c5ae98640ee6","tarball":"https://registry.npmjs.org/@asaayers/redux-saga-tester/-/redux-saga-tester-0.1.0.tgz","integrity":"sha512-yRZOsn/GKfhIUAI1Jy5FaWRAOwJg6T38Jqs6r2KnQN65WaE/5RBq1onKjDkQfuVxvmjWeCj+PruW8aWDtlJtIw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDogyjPSWJNqxCYUhyiBwvTS/n4vre6y0vtbQj05oXLkwIhAPnQRZFlRA42nZIoYEzLuO7fmvVcM4zjmrt1lWGQ3FIo"}]},"maintainers":[{"name":"asaayers","email":"Asa@AsaAyers.com"}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/redux-saga-tester-0.1.0.tgz_1473986434317_0.03427800536155701"}},"0.1.1":{"name":"@asaayers/redux-saga-tester","version":"0.1.1","description":"Test your sagas by intercepting effects","main":"lib/index.js","dependencies":{},"devDependencies":{"babel-jest":"^15.0.0","babel-plugin-transform-es2015-spread":"^6.8.0","babel-plugin-transform-object-rest-spread":"^6.8.0","babel-polyfill":"^6.13.0","eslint":"^3.5.0","jest":"^15.1.1","redux":"^3.6.0","redux-saga":"^0.11.1"},"scripts":{"build":"BABEL_ENV=production babel src -d lib --ignore tests/","lint":"eslint src","test":"jest"},"files":["lib"],"repository":{"type":"git","url":"git+ssh://git@gitlab.com/AsaAyers/redux-saga-tester.git"},"author":{"name":"Asa Ayers","email":"Asa@AsaAyers.com"},"license":"ISC","bugs":{"url":"https://gitlab.com/AsaAyers/redux-saga-tester/issues"},"homepage":"https://gitlab.com/AsaAyers/redux-saga-tester#README","gitHead":"4a88985579c537a70bb317e37eaae550522f9860","_id":"@asaayers/redux-saga-tester@0.1.1","_shasum":"c2d7840c730ff3f4a7ecbba3a43eebcf4f8a5b5d","_from":".","_npmVersion":"3.8.3","_nodeVersion":"4.4.1","_npmUser":{"name":"asaayers","email":"Asa@AsaAyers.com"},"dist":{"shasum":"c2d7840c730ff3f4a7ecbba3a43eebcf4f8a5b5d","tarball":"https://registry.npmjs.org/@asaayers/redux-saga-tester/-/redux-saga-tester-0.1.1.tgz","integrity":"sha512-csH43Y+Feuk0XoHAege63EJ87sm0wWbOtgbHkHnIW9X18ANFDhjgFc575oQE0dARx218uebRSs1sjMccJFC3cQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCdYkVcJJkI1kExFrnfLGREpddyEukozS4xZXQ45DJatQIgX/fyATDef+Ta9nPPNgIftAc6HPAo/j20zXgvVfDe4oA="}]},"maintainers":[{"name":"asaayers","email":"Asa@AsaAyers.com"}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/redux-saga-tester-0.1.1.tgz_1473986615417_0.903652694541961"}}},"readme":"# @AsaAyers/redux-saga-tester\n\n## Project Status: Experimental\n\nExpect every 0.x release to break the API. Nothing is settled.\n\nI am releasing this under my namespace because [3LOK][3LOK] already [has a\n`redux-saga-tester`][redux-saga-tester]. When the API settles and I want to\nrelease a 1.0.0, I'd like to have a [different\nname](https://gitlab.com/AsaAyers/redux-saga-tester/issues/1).\n\n## Project Goals\n\n* Tests should not be tightly coupled to implementation\n* Tests should read in the same order as the saga\n  * I think this makes them easier to read and understand\n\n## Example\n\nFor this example I created a toy saga based on [3LOK's comment][comment].\n\n```js\nfunction* addSaga() {\n    const a = yield select(selectA)\n    const b = yield select(selectB)\n\n    const total = yield call(sum, a, b)\n\n    yield put({\n        type: \"RESULT\",\n        payload: total\n    })\n}\n```\n\nI want to verify that this saga uses `sum()` to add `store.a` and `store.b` and\nupdates `store.result` with the total. By default the tester doesn't tell you\nabout `yield select` or `yield put`. they happen automatically.\n\n```js\nimport { addSaga, sum, reducer, selectResult, selectA, selectB } from \"./add-saga.js\"\ntest(\"add-saga\", () => {\n    const tester = SagaTester({\n        initialState: {\n            a: 2,\n            b: 3,\n        },\n        reducer,\n    })\n\n    tester.testAgainst(addSaga, function* ({ getState }) {\n        let actual\n\n        // yield gives you the next effect from your saga that you want to test.\n        // This didn't care about the selectors, they execute normally.\n        actual = yield\n        expect(actual).toEqual(call(sum, 2, 3))\n        const callSumResult = 5\n\n        // You need to yield a result back to the saga to continue and pick up\n        // the next significant effect.\n        actual = yield callSumResult\n        // END is a special value automatically emitted when/if your saga ends\n        expect(actual).toBe(END)\n\n        // Instead of verifying the action was fired, now verify the state.\n        actual = selectResult(getState())\n        expect(actual).toBe(callSumResult)\n    })\n})\n```\n\nThis test and some other variations are available in\n[`src/tests/add-saga.test.js`](./src/tests/add-saga.test.js).\n\n[redux-saga-tester]: https://www.npmjs.com/package/redux-saga-tester\n[3LOK]: https://github.com/3LOK\n[redux-saga]: http://yelouafi.github.io/redux-saga/\n[comment]: https://github.com/yelouafi/redux-saga/issues/518#issuecomment-246527347\n","maintainers":[{"name":"asaayers","email":"Asa@AsaAyers.com"}],"time":{"modified":"2022-06-12T14:49:06.643Z","created":"2016-09-16T00:40:34.556Z","0.1.0":"2016-09-16T00:40:34.556Z","0.1.1":"2016-09-16T00:43:37.042Z"},"homepage":"https://gitlab.com/AsaAyers/redux-saga-tester#README","repository":{"type":"git","url":"git+ssh://git@gitlab.com/AsaAyers/redux-saga-tester.git"},"author":{"name":"Asa Ayers","email":"Asa@AsaAyers.com"},"bugs":{"url":"https://gitlab.com/AsaAyers/redux-saga-tester/issues"},"license":"ISC","readmeFilename":"README.md"}