Skip to content

Instantly share code, notes, and snippets.

@stujo
Last active October 20, 2016 00:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stujo/2ebca81383a71c012a22c8ca9f76cd1e to your computer and use it in GitHub Desktop.
Save stujo/2ebca81383a71c012a22c8ca9f76cd1e to your computer and use it in GitHub Desktop.
Example test from the ReactStarterKit
/**
* React Starter Kit (https://www.reactstarterkit.com/)
*
* Copyright © 2014-2016 Kriasoft, LLC. All rights reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE.txt file in the root directory of this source tree.
*/
/* eslint-env mocha */
/* eslint-disable padded-blocks, no-unused-expressions */
import React from 'react';
import { expect } from 'chai';
import { render } from 'enzyme';
import App from '../App';
import Layout from './Layout';
describe('Layout', () => {
it('renders children correctly', () => {
const wrapper = render(
<App context={{ insertCss: () => {} }}>
<Layout>
<div className="child" />
</Layout>
</App>
);
expect(wrapper.find('div.child').length).to.eq(1);
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment