Skip to content

Commit

Permalink
[Tests] add tests for top-level enzyme entry points.
Browse files Browse the repository at this point in the history
  • Loading branch information
ljharb committed Mar 14, 2019
1 parent 210c10e commit 2694da4
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 0 deletions.
7 changes: 7 additions & 0 deletions packages/enzyme-test-suite/test/ReactWrapper-spec.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ import {
render,
ReactWrapper,
} from 'enzyme';
import mountEntry from 'enzyme/mount';
import ReactWrapperEntry from 'enzyme/ReactWrapper';
import {
ITERATOR_SYMBOL,
withSetStateAllowed,
Expand Down Expand Up @@ -55,6 +57,11 @@ const getWrapperPropSelector = prop => x => x.prop(prop);
const CALLING_SETSTATE_CALLBACK_WITH_UNDEFINED = is('^15.5');

describeWithDOM('mount', () => {
describe('top level entry points', () => {
expect(mountEntry).to.equal(mount);
expect(ReactWrapperEntry).to.equal(ReactWrapper);
});

describe('top level wrapper', () => {
it('does what i expect', () => {
class Box extends React.Component {
Expand Down
7 changes: 7 additions & 0 deletions packages/enzyme-test-suite/test/ShallowWrapper-spec.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ import {
render,
ShallowWrapper,
} from 'enzyme';
import shallowEntry from 'enzyme/shallow';
import ShallowWrapperEntry from 'enzyme/ShallowWrapper';
import {
ITERATOR_SYMBOL,
withSetStateAllowed,
Expand Down Expand Up @@ -58,6 +60,11 @@ const getElementPropSelector = prop => x => x.props[prop];
const getWrapperPropSelector = prop => x => x.prop(prop);

describe('shallow', () => {
describe('top level entry points', () => {
expect(shallowEntry).to.equal(shallow);
expect(ShallowWrapperEntry).to.equal(ShallowWrapper);
});

describe('top level wrapper', () => {
it('does what i expect', () => {
class Box extends React.Component {
Expand Down
5 changes: 5 additions & 0 deletions packages/enzyme-test-suite/test/staticRender-spec.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,18 @@ import React from 'react';
import PropTypes from 'prop-types';
import { expect } from 'chai';
import { render } from 'enzyme';
import renderEntry from 'enzyme/render';

import './_helpers/setupAdapters';
import { describeWithDOM, describeIf } from './_helpers';
import { is } from './_helpers/version';
import { createClass } from './_helpers/react-compat';

describeWithDOM('render', () => {
describe('top level entry points', () => {
expect(renderEntry).to.equal(render);
});

describeIf(is('> 0.13'), 'context', () => {
it('can pass in context', () => {
const SimpleComponent = createClass({
Expand Down

0 comments on commit 2694da4

Please sign in to comment.