{"id":16390726,"url":"https://github.com/mikeheddes/react-testing-demo","last_synced_at":"2025-03-23T04:31:39.913Z","repository":{"id":97110401,"uuid":"155415133","full_name":"mikeheddes/react-testing-demo","owner":"mikeheddes","description":"How to test your React App with Jest","archived":false,"fork":false,"pushed_at":"2018-11-11T12:22:47.000Z","size":1028,"stargazers_count":16,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-18T17:56:40.306Z","etag":null,"topics":["enzyme","jest","react","react-test-renderer","testing"],"latest_commit_sha":null,"homepage":"http://mikeheddes.github.io/react-testing-demo","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/mikeheddes.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","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":"2018-10-30T16:02:50.000Z","updated_at":"2021-08-13T05:48:45.000Z","dependencies_parsed_at":null,"dependency_job_id":"07680e05-b288-4ff6-877d-47300a738866","html_url":"https://github.com/mikeheddes/react-testing-demo","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/mikeheddes%2Freact-testing-demo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mikeheddes%2Freact-testing-demo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mikeheddes%2Freact-testing-demo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mikeheddes%2Freact-testing-demo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mikeheddes","download_url":"https://codeload.github.com/mikeheddes/react-testing-demo/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245056889,"owners_count":20553855,"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","react","react-test-renderer","testing"],"created_at":"2024-10-11T04:44:03.387Z","updated_at":"2025-03-23T04:31:39.900Z","avatar_url":"https://github.com/mikeheddes.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Testing your React App with Jest 🃏\n\nThe following scenarios will be covered:\n\n### Basic\n\n1. Test an interaction with a DOM element that updates state. [[`Counter`](https://github.com/mikeheddes/react-testing-demo/blob/master/src/components/Counter.test.jsx)]\n1. Test a component wrapped in a [HOC](https://reactjs.org/docs/higher-order-components.html) (e.g. [Redux](https://redux.js.org/)' mapState). [[`ScreenWidth`](https://github.com/mikeheddes/react-testing-demo/blob/master/src/components/ScreenWidth.test.jsx), [`PageURL`](https://github.com/mikeheddes/react-testing-demo/blob/master/src/components/PageURL.test.jsx)]\n1. Create [snapshots](https://jestjs.io/docs/en/snapshot-testing) for the above. [[`All component tests`](https://github.com/mikeheddes/react-testing-demo/blob/master/src/components)]\n\n### Advanced\n\n4. Test a component that is wrapped in the [React context](https://reactjs.org/docs/context.html). [[`PageURL`](https://github.com/mikeheddes/react-testing-demo/blob/master/src/components/PageURL.test.jsx)]\n1. Test a [React ref](https://reactjs.org/docs/refs-and-the-dom.html) attached to a DOM node. [[`Reminder`](https://github.com/mikeheddes/react-testing-demo/blob/test-solutions/src/components/Reminder.test.jsx)]\n1. Test code that uses browser global variables. [[`ScreenWidth`](https://github.com/mikeheddes/react-testing-demo/blob/master/src/components/ScreenWidth.test.jsx)]\n\n### Project structure\n\nThe components and tests are in [`./src/components`](https://github.com/mikeheddes/react-testing-demo/tree/master/src/components).\nThe tests for `Component.jsx` are in `Component.test.jsx`.\n\n## Available Scripts\n\nIn the project directory, you can run:\n\n### `npm start`\n\nRuns the app in the development mode.\u003cbr\u003e\nOpen [http://localhost:3000](http://localhost:3000) to view it in the browser.\n\nThe page will reload if you make edits.\u003cbr\u003e\nYou will also see any lint errors in the console.\n\n### `npm test`\n\nRuns the tests in watch mode.\n\n### `npm run test:watch`\n\nRuns the tests in watch mode and shows the test coverage.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmikeheddes%2Freact-testing-demo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmikeheddes%2Freact-testing-demo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmikeheddes%2Freact-testing-demo/lists"}