{"id":13475641,"url":"https://github.com/varmais/react-native-unit-tests","last_synced_at":"2025-10-25T19:31:01.821Z","repository":{"id":151434422,"uuid":"55256830","full_name":"varmais/react-native-unit-tests","owner":"varmais","description":"Example how to test React Native components","archived":false,"fork":false,"pushed_at":"2017-11-20T12:23:39.000Z","size":161,"stargazers_count":80,"open_issues_count":0,"forks_count":17,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-10-01T05:55:30.657Z","etag":null,"topics":["enzyme","jest","mocha","react-native","rewire-modules","test-driven-development","testing-tools"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/varmais.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-04-01T19:21:39.000Z","updated_at":"2023-12-16T12:47:51.000Z","dependencies_parsed_at":null,"dependency_job_id":"d2a7fbbf-2e9c-4453-b540-e3dabca92c76","html_url":"https://github.com/varmais/react-native-unit-tests","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/varmais%2Freact-native-unit-tests","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/varmais%2Freact-native-unit-tests/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/varmais%2Freact-native-unit-tests/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/varmais%2Freact-native-unit-tests/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/varmais","download_url":"https://codeload.github.com/varmais/react-native-unit-tests/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":219865149,"owners_count":16555931,"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":["enzyme","jest","mocha","react-native","rewire-modules","test-driven-development","testing-tools"],"created_at":"2024-07-31T16:01:22.157Z","updated_at":"2025-10-25T19:31:01.378Z","avatar_url":"https://github.com/varmais.png","language":"JavaScript","readme":"# React Native Testing Example App\n\nExample application to show how to unit test React Native components and rewire modules using ES6 import syntax.\n\nApplication tested only on iOS but should run on Android as well. Main purpose of this application is to show how to setup unit testing for React Native components using AirBnB's enzyme library. \n\nApplication also utilizes babel-plugin-rewire as an example how to rewire modules which are imported using ES6 syntax instead of CommonJS syntax.\n\nI've written about unit testing React Native components in more depth in [Valuemotive](http://valuemotive.com/) blog: [Unit Testing React Native Components with Mocha and Enzyme](https://blog.valuemotive.com/unit-testing-react-native-components-with-mocha-and-enzyme-1d8a669ece29).\n\nEDIT: Added Jest tests.\n\n## Installation and usage\n\n    $ npm install\n    \n    All mocha tests:\n    $ npm run mocha\n    \n    Single component on mocha watch mode:\n    $ npm run mocha:watch ReactNativeTestingUtils\n    \n    All jest tests:\n    $ npm run jest\n    \n    Jest watch mode:\n    $ npm run jest -- --watch\n    \n    \n## Modules used for testing:\n\n- [mocha](https://mochajs.org/)\n- [sinon](http://sinonjs.org/)\n- [chai](http://chaijs.com/)\n- [enzyme](http://airbnb.io/enzyme/)\n- [babel-plugin-rewire](https://www.npmjs.com/package/babel-plugin-rewire)\n- [jest](https://facebook.github.io/jest/)\n\n\n## License\n\nMIT License\n\nCopyright (c) 2017 [VarmaIS](https://varmais.fi)\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvarmais%2Freact-native-unit-tests","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvarmais%2Freact-native-unit-tests","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvarmais%2Freact-native-unit-tests/lists"}