-
-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds documentation for using Enzyme with Lab (#324)
* adds doc for using enzyme with lab * adds link to guide doc for using enzyme with lab * documentation
- Loading branch information
1 parent
f285e5d
commit eb9d663
Showing
2 changed files
with
29 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# Using Enzyme with Lab and Code | ||
|
||
[Lab](https://github.com/hapijs/lab) is a simple test utility for node & part of the [Hapi.js](https://github.com/hapijs/hapi) framework universe. Lab's initial code borrowed heavily from [Mocha](https://github.com/mochajs/mocha). [Code](https://github.com/hapijs/code) is Lab's standard assertion library and was created as a direct rewrite of [Chai](https://github.com/chaijs). | ||
|
||
|
||
# Example Test: Enzyme + Lab + Code | ||
|
||
```jsx | ||
const Code = require('code'); | ||
const Lab = require('lab'); | ||
const lab = exports.lab = Lab.script(); | ||
import { shallow, mount, render } from 'enzyme'; | ||
import React from 'react'; | ||
|
||
lab.suite('A suite', () => { | ||
lab.test("calls componentDidMount", (done) => { | ||
const wrapper = mount(<Foo />); | ||
Code.expect(Foo.prototype.componentDidMount.calledOnce).to.equal(true); | ||
done(); | ||
}); | ||
}); | ||
|
||
``` | ||
|
||
|
||
## Example Projects | ||
|
||
- [enzyme-example-lab](https://github.com/gattermeier/enzyme-example-lab) |