{"id":24770278,"url":"https://github.com/voodoocreation/react-test-wrapper","last_synced_at":"2025-10-11T19:31:08.840Z","repository":{"id":36474040,"uuid":"227022239","full_name":"voodoocreation/react-test-wrapper","owner":"voodoocreation","description":"A set of classes to make setting up React components for unit tests easy.","archived":false,"fork":false,"pushed_at":"2024-01-24T04:12:20.000Z","size":591,"stargazers_count":3,"open_issues_count":3,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-04-26T04:04:46.187Z","etag":null,"topics":["enzyme","jest","react","react-component","react-components","react-redux","react-test","react-test-wrapper","react-testing","react-testing-library","reactjs","redux","test","test-wrapper","testing","tests","typescript","unit-test","unit-testing","unit-tests"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/voodoocreation.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":"2019-12-10T03:36:16.000Z","updated_at":"2024-08-21T18:05:21.327Z","dependencies_parsed_at":"2024-08-21T18:05:10.251Z","dependency_job_id":"c9070f45-cbb1-4078-9d44-455eff623bfc","html_url":"https://github.com/voodoocreation/react-test-wrapper","commit_stats":{"total_commits":29,"total_committers":1,"mean_commits":29.0,"dds":0.0,"last_synced_commit":"76b747ccdb2e7a6c16b4dc1284d149c462b4e729"},"previous_names":[],"tags_count":22,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/voodoocreation%2Freact-test-wrapper","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/voodoocreation%2Freact-test-wrapper/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/voodoocreation%2Freact-test-wrapper/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/voodoocreation%2Freact-test-wrapper/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/voodoocreation","download_url":"https://codeload.github.com/voodoocreation/react-test-wrapper/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":236122003,"owners_count":19098257,"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-component","react-components","react-redux","react-test","react-test-wrapper","react-testing","react-testing-library","reactjs","redux","test","test-wrapper","testing","tests","typescript","unit-test","unit-testing","unit-tests"],"created_at":"2025-01-29T03:03:59.164Z","updated_at":"2025-10-11T19:31:03.539Z","avatar_url":"https://github.com/voodoocreation.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"React Test Wrapper\n==================\n\nThe intention of this package is to provide a simple, clean way of setting up your React components\nfor unit tests, to reduce test setup boilerplate code, whilst automatically inferring your component\nTypeScript definitions (props, instance methods etc) to avoid needing to manually import types and\nretype definitions in your tests and also providing better inline IDE autocomplete/validation support.\n\nThe classes provided are also able to be extended to add to the API that's available, if your\nproject requires additional functionality as part of your component test setup.\n\nThe concept behind it is that you can create a single instance of the wrapper class at the top of\nyour test file and define the defaults to use there, then in each test scenario you can reference\nthe single instance and define the scenario-specific props/children etc. chaining the public methods,\nthen finally calling the `render` method to return the rendering result.\n\nThe scenario-specific definitions are reset each time you call `render`, which\nwill ensure it reverts back to only the defaults set at the top and prevents scenario data from leaking\nbetween tests.\n\n## Example\n```typescript jsx\nimport { screen, Wrapper } from \"react-test-wrapper\";\n\nconst component = new Wrapper(SomeComponent)\n  .withDefaultChildren(\u003cdiv className=\"Child\" /\u003e)\n  .withDefaultProps({\n    prop1: \"Default value 1\",\n    prop2: \"Default value 2\"\n  });\n\ndescribe(\"when testing a scenario\", () =\u003e {\n  let result: ReturnType\u003ctypeof component.render\u003e;\n\n  it(\"renders the component\", () =\u003e {\n    result = component\n      .withProps({\n        prop1: \"Scenario value 1\"\n      })\n      .render();\n  });\n\n  it(\"uses the scenario-specific value for prop1\", () =\u003e {\n    expect(screen.getByText(\"Scenario value 1\")).toBeDefined();\n  });\n\n  it(\"uses the default value for prop2\", () =\u003e {\n    expect(screen.getByText(\"Default value 2\")).toBeDefined();\n  });\n\n  it(\"updates the props\", () =\u003e {\n    result.updateProps({\n      prop1: \"New scenario value 1\"\n    });\n  });\n\n  it(\"renders the new prop value\", () =\u003e {\n    expect(screen.getByText(\"New scenario value 1\")).toBeDefined();\n  });\n});\n```\n\nPackage contents\n----------------\n- [`Wrapper`](/docs/react-testing-library/Wrapper.md)\n- [`WrapperWithIntl`](/docs/react-testing-library/WrapperWithIntl.md)\n- [`WrapperWithRedux`](/docs/react-testing-library/WrapperWithRedux.md)\n- [Custom `react-testing-library` queries](/docs/react-testing-library/queries.md)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvoodoocreation%2Freact-test-wrapper","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvoodoocreation%2Freact-test-wrapper","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvoodoocreation%2Freact-test-wrapper/lists"}