https://github.com/legitcode/enzymed
decorators and automatic testing for enzyme by airbnb
https://github.com/legitcode/enzymed
Last synced: 10 months ago
JSON representation
decorators and automatic testing for enzyme by airbnb
- Host: GitHub
- URL: https://github.com/legitcode/enzymed
- Owner: Legitcode
- Created: 2015-12-06T22:50:58.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2015-12-06T23:30:59.000Z (about 10 years ago)
- Last Synced: 2025-01-29T09:30:45.568Z (12 months ago)
- Language: JavaScript
- Size: 3.91 KB
- Stars: 3
- Watchers: 6
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
##enzymed
Decorators and test running for [enzyme](https://github.com/airbnb/enzyme).
```js
import React from 'react'
@test('render the correct text', (wrapper, expect) => expect(wrapper.text()).to.equal('hi'))
export default class Page extends React.Component{
render(){
return (
hi
)
}
}
```
Multiple tests are better written like so:
```js
@test('render the correct text', tests)
export default class Page extends React.Component{
render(){
return (
hi
)
}
}
function tests(wrapper, expect){
expect(wrapper.text()).to.equal('hi')
expect(wrapper.find('.cool')).to.ok
}
```
Run tests with `enzymed example/*`
##How it works
This library includes `chai` and `mocha` for you. Makes it super easy to write your tests as you make your components.
##Todo
- remove `@test` declaration when building code.