{"id":13339549,"url":"https://github.com/anoop-gupt/react-unit-testing","last_synced_at":"2025-03-11T14:31:42.639Z","repository":{"id":75737703,"uuid":"126541229","full_name":"anoop-gupt/react-unit-testing","owner":"anoop-gupt","description":"This repository is meant to showcase various part of react unit testing with example code snippets","archived":false,"fork":false,"pushed_at":"2018-07-12T21:43:43.000Z","size":23,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":6,"default_branch":"master","last_synced_at":"2024-10-24T02:30:32.163Z","etag":null,"topics":["enzyme","enzyme-testing","jest","reactjs","redux","unit-testing"],"latest_commit_sha":null,"homepage":null,"language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"agpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/anoop-gupt.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-03-23T21:37:36.000Z","updated_at":"2018-07-12T21:43:45.000Z","dependencies_parsed_at":"2023-04-03T10:48:10.783Z","dependency_job_id":null,"html_url":"https://github.com/anoop-gupt/react-unit-testing","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/anoop-gupt%2Freact-unit-testing","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anoop-gupt%2Freact-unit-testing/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anoop-gupt%2Freact-unit-testing/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anoop-gupt%2Freact-unit-testing/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/anoop-gupt","download_url":"https://codeload.github.com/anoop-gupt/react-unit-testing/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243051900,"owners_count":20228290,"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","enzyme-testing","jest","reactjs","redux","unit-testing"],"created_at":"2024-07-29T19:20:21.740Z","updated_at":"2025-03-11T14:31:42.572Z","avatar_url":"https://github.com/anoop-gupt.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# ReactUnitTesting\nThis repository is meant to showcase various part of react unit testing with example code snippets\nWeb Url: https://anoop-gupt.github.io/react-unit-testing/\n\n# Jest Test React - Testing React Apps with Jest and Enzyme (With Code Snippets)\n\n-Types of Tests\n  - Unit Testing\n  - Integration Testing\n  - Functional Testing\n  - E2E Testing\n  - Test Runner v/s Test Environment v/s Test Suite\n  - Convention and Organization of tests\n- React Unit Testing\n- Snap Shot Testing\n- What is Jest\n  - Basic Concepts\n  - Mocking/ Stubbing\n  - Expect/ Assert\n  - Matchers\n- What is Enzyme\n  - Shallow\n  - Mount\n  - Static\n- Enviornment Setup\n  - Installation\n  - Run\n  - Coverage and reporting\n- How to test\n  - Test Pure Components\n  - Test Stateful Components\n    - component.state()\n  - Test Life Cycle Methods\n  - Test Redux mapStateToProps and mapDispatchToProps\n      - Test Actions\n      - Test Reducers\n      - Test Store\n  - Test Custom Methods\n  - Test Routes\n  - Test Async/ Promises\n    - \u003cservice-name\u003e.mockImplementationOnce(() =\u003e Promise.resolve());\n    - \u003cservice\u003e.mockImplementation(() =\u003e Promise.resolve(({ key: 'value' })));\n    - mock.onAny().replyOnce(200, {});\n- Test Axios/Fetch\n- Test Browser Object Modal - Window and Document Objects\n- Test Timers\n- Debug your test\n- Appendix\n\n\n\n# Types of Tests\nDuring this stage of web application development, issues such as that of web application security, the functioning of the site, its access to handicapped as well as regular users and its ability to handle traffic is checked. Purpose is to address issues before the system is revealed to the public. \n\nBasically there are 6 ways to test a web application. They are\n  - Unit Testing\n  - Integration Testing\n  - Functional Testing\n  - E2E Testing\n  - Test Runner v/s Test Environment v/s Test Suite\n  - Convention and Organization of tests\n\n\n# Unit testing\nUnit test is a function that test the behaviour of small unit of functionality resulting in pass or fail. It is used to test all the possible scenarioes including edge case scenarios by mimicking the same behaviour. \n\nIt is used consistently and can cover major part of your code. Higher no of covered test scenarios give developer confidence to refactor the code anytime without thinking about breaking any scenrio or functionality.\n\n# Integration Testing\nIntegration Testing is next level of testing where individual units are combined and tested as a group. This is used to expose faults in the interaction among unit components. It occurs after unit testing.\n\n# Functional Testing\nFunctional Testing is a type of black box testing where objective is to make sure that system is meeting all the functional requirements. In other words, it is a way of checking software to ensure that it has all the required functionality that is specified within its business rules ducument.\n\n# E2E Testing\nEnd to end testing is more about the actual flow through a system in a more realistic end user scenario. It is a technique used to examine if the flow of an application right from start to finish is behaving as expected. The purpose of performing end-to-end testing is to identify system dependencies and to ensure that the data integrity is maintained between various system components and systems.\n\n# Test Runner v/s Test Environment v/s Test Suite\nA test runner is the tool or the library that picks set of unit test cases and a set of configuration settings then executes those test cases and write the result of execution in a log file. \nTest environment is generally setup of softwares and hardware to execute test cases.\nA test suite is also known as 'validation suit', it is a collection of test cases that are intended to be used to test a software program to show that it has some specified set of behaviours.\n\n# Convention and Organization of tests\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fanoop-gupt%2Freact-unit-testing","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fanoop-gupt%2Freact-unit-testing","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fanoop-gupt%2Freact-unit-testing/lists"}