https://github.com/kureev/jest-styled-components-matcher
Jest matcher for styled components (React Native)
https://github.com/kureev/jest-styled-components-matcher
jest-matchers react-native styled-components
Last synced: 9 months ago
JSON representation
Jest matcher for styled components (React Native)
- Host: GitHub
- URL: https://github.com/kureev/jest-styled-components-matcher
- Owner: Kureev
- Created: 2017-04-18T15:09:16.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2017-04-25T09:19:19.000Z (about 9 years ago)
- Last Synced: 2025-02-10T20:11:13.886Z (over 1 year ago)
- Topics: jest-matchers, react-native, styled-components
- Language: JavaScript
- Homepage:
- Size: 52.7 KB
- Stars: 14
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
[React Native] Jest matchers for styled-components
==
## Motivation
Add a way to check if styled-component has a style rule (or style rule has a right value)
## Installation
```bash
yarn add jest-styled-components-matcher --dev
```
or
```bash
npm i jest-styled-components-matcher -D
```
## Usage
Just import it in the place you're going to use it:
```js
import 'jest-styled-components-matcher'
```
That's it! Now you can use it in your tests:
```js
describe('Avatar', () => {
it('uses default size property (64) to calculate proper border radius (32)', () => {
expect(shallow()).toHaveStyleRule('border-radius', 32);
});
});
```
## Assertation messages
- Wrong value

- Missing rule
