Skip to content

Latest commit

 

History

History
30 lines (20 loc) · 956 Bytes

lab.md

File metadata and controls

30 lines (20 loc) · 956 Bytes

Using enzyme with Lab and Code

Lab is a simple test utility for node & part of the Hapi.js framework universe. Lab's initial code borrowed heavily from Mocha. Code is Lab's standard assertion library and was created as a direct rewrite of Chai.

Example Test: enzyme + Lab + Code

import { shallow, mount, render } from 'enzyme';
import React from 'react';

const Code = require('code');
const Lab = require('lab');

const lab = Lab.script();
exports.lab = lab;

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