From eb9d66386babbbe47bd66d453297121f58d3b60a Mon Sep 17 00:00:00 2001 From: Matthias Gattermeier Date: Sun, 17 Apr 2016 20:39:34 -0400 Subject: [PATCH] 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 --- README.md | 1 + docs/guides/lab.md | 28 ++++++++++++++++++++++++++++ 2 files changed, 29 insertions(+) create mode 100644 docs/guides/lab.md diff --git a/README.md b/README.md index 7e3abda98..7ba2ff253 100644 --- a/README.md +++ b/README.md @@ -37,6 +37,7 @@ testing your React components, you can consider using [jasmine-enzyme](https://g [Using Enzyme with Jest](/docs/guides/jest.md) +[Using Enzyme with Lab](/docs/guides/lab.md) ### [Installation](/docs/installation/README.md) diff --git a/docs/guides/lab.md b/docs/guides/lab.md new file mode 100644 index 000000000..0c298c79f --- /dev/null +++ b/docs/guides/lab.md @@ -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(); + Code.expect(Foo.prototype.componentDidMount.calledOnce).to.equal(true); + done(); + }); +}); + +``` + + +## Example Projects + +- [enzyme-example-lab](https://github.com/gattermeier/enzyme-example-lab)