https://github.com/neworbit/alsatian-react-testing-library
Helpers for testing React in TypeScript with React Testing Library and Alsatian
https://github.com/neworbit/alsatian-react-testing-library
hacktoberfest
Last synced: about 1 year ago
JSON representation
Helpers for testing React in TypeScript with React Testing Library and Alsatian
- Host: GitHub
- URL: https://github.com/neworbit/alsatian-react-testing-library
- Owner: NewOrbit
- License: mit
- Created: 2020-10-09T09:26:42.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2022-12-11T20:25:51.000Z (over 3 years ago)
- Last Synced: 2025-02-13T10:38:35.142Z (over 1 year ago)
- Topics: hacktoberfest
- Language: TypeScript
- Homepage:
- Size: 206 KB
- Stars: 0
- Watchers: 4
- Forks: 0
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# alsatian-react-testing-library
This package provides helpers for testing React components in Typescript with React Testing Library and Alsatian.
## Installation
```cmd
npm i alsatian-react-testing-library
```
## Usage
```tsx
import { Test, TestFixture } from "alsatian";
import { ExpectElement } from "alsatian-react-testing-library";
import { render } from "@testing-library/react";
import { MyComponent } from "./MyComponent";
configureJSDOM(); // This is important!
@TestFixture("MyComponent")
export class MyComponentTests {
@Test("should render component")
public shouldRenderComponent() {
const wrapper = render();
ExpectElement(wrapper).toMatchElement(
My components body.
);
}
}
```
## License
Made with :sparkling_heart: by [NewOrbit](https://www.neworbit.co.uk/) in Oxfordshire, and licensed under the [MIT Licence](LICENSE)