{"id":18412691,"url":"https://github.com/platzidev/redux-duck-test","last_synced_at":"2025-04-07T11:32:13.606Z","repository":{"id":57350574,"uuid":"58331468","full_name":"PlatziDev/redux-duck-test","owner":"PlatziDev","description":"Helper functions for testing redux ducks made with redux-duck library","archived":false,"fork":false,"pushed_at":"2016-12-10T05:32:17.000Z","size":9,"stargazers_count":10,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-22T17:11:27.922Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/PlatziDev.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-05-08T21:08:51.000Z","updated_at":"2025-02-06T04:17:27.000Z","dependencies_parsed_at":"2022-09-16T21:11:51.121Z","dependency_job_id":null,"html_url":"https://github.com/PlatziDev/redux-duck-test","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PlatziDev%2Fredux-duck-test","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PlatziDev%2Fredux-duck-test/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PlatziDev%2Fredux-duck-test/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PlatziDev%2Fredux-duck-test/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/PlatziDev","download_url":"https://codeload.github.com/PlatziDev/redux-duck-test/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247644488,"owners_count":20972302,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-06T03:43:07.324Z","updated_at":"2025-04-07T11:32:08.598Z","avatar_url":"https://github.com/PlatziDev.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Redux Duck Test\nHelper functions for testing redux ducks made with [redux-duck](https://github.com/sergiodxa/redux-duck/) library.\n\n## Installation\n```bash\nnpm i -D redux-duck-test\n```\n\n## API\n### Test action type\n```javascript\nimport { testType } from 'redux-duck-test';\nimport { ADD } from '../duck/messages';\n\nconst result = testType({\n  expected: ADD,\n  actionName: 'ADD',\n  duckName: 'messages',\n  moduleName: 'my-app',\n});\n```\n- `testType` receive an object with the test specification.\n- The `expected` key is your action type.\n- The `actionName` key is the name of your action (eg. `ADD`).\n- The `duckName` key is the name of your duck (eg. `messages`).\n- The `moduleName` key is the name of your module (eg. `my-app`) (optional).\n\n### Test action creator\n```javascript\nimport { testAction } from 'redux-duck-test';\nimport { ADD, add } from '../duck/messages';\n\nconst result = testAction({\n  actionCreator: add,\n  payload: {\n    id: 1,\n    content: 'hello world!',\n  },\n  expected: {\n    type: ADD,\n    payload: {\n      id: 1,\n      content: 'hello world!',\n    },\n  },\n});\n```\n- `testAction` receive an object with the test specification.\n- The `actionCreator` key is the action creator function to test.\n- The `payload` key is the payload to send to the action creator.\n- The `expected` key is the expected action object.\n\n### Test reducer\n```javascript\nimport { testReducer } from 'redux-duck-test';\nimport { Map as map } from 'immutable';\nimport reducer, { add } from '../duck/messages';\n\nconst result = testReducer({\n  reducer,\n  state: map(),\n  action: add({\n    id: 1,\n    content: 'hello world',\n  }),\n  expected: map({\n    '1': {\n      id: 1,\n      content: 'hello world',\n    },\n  }),\n});\n```\n- `testReducer` receive an object with the test specification.\n- The `reducer` key is the reducer to test.\n- The `state` key is the initial state passed to the reducer.\n- The `action` key is the action to perform in the reducer.\n- The `expected` key is the expected next state.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fplatzidev%2Fredux-duck-test","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fplatzidev%2Fredux-duck-test","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fplatzidev%2Fredux-duck-test/lists"}