How to use the enzyme.configure function in enzyme

To help you get started, we’ve selected a few enzyme examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github uxcore / uxcore-steps / tests / Steps.spec.js View on Github external
/* eslint-disable react/jsx-filename-extension */

import expect from 'expect.js';
import Enzyme, { mount } from 'enzyme';
import Adapter from 'enzyme-adapter-react-16';
import React from 'react';
import assign from 'object-assign';
import Steps from '../src';

Enzyme.configure({ adapter: new Adapter() });

const generateSteps = (options = {}) => {
  const opts = assign({}, {
    current: 1,
    direction: '',
    showIcon: true,
    type: 'default', // default title-on-top or long-desc
  }, options || {});
  const items = ['hello', 'hi', 'wola'].map((i) => {
    if (i === 'wola') {
      return ;
    }

    return ;
  });
  const wrapper = mount(
github telus / tds-core / config / jest / setupEnzyme.js View on Github external
// Note: This file is only necessary for the tests that use `@jest-environment node` (the SSR tests)

import Enzyme from 'enzyme'
import Adapter from 'enzyme-adapter-react-16'

Enzyme.configure({ adapter: new Adapter() })
github Lattice-Automation / seqviz / config / jest / setup.js View on Github external
import Enzyme from "enzyme";
import Adapter from "enzyme-adapter-react-16";
import sizeMe from "react-sizeme";
// import fetch from "jest-fetch-mock";
import "core-js/stable";
import "regenerator-runtime/runtime";

Enzyme.configure({ adapter: new Adapter() });

sizeMe.noPlaceholders = true;
// global.fetch = fetch;
localStorage.clear();
github algolia / react-instantsearch / packages / react-instantsearch-dom-maps / src / __tests__ / Redo.js View on Github external
import React from 'react';
import Enzyme, { shallow } from 'enzyme';
import Adapter from 'enzyme-adapter-react-16';
import { createFakeMapInstance } from '../../test/mockGoogleMaps';
import { Redo } from '../Redo';

Enzyme.configure({ adapter: new Adapter() });

describe('Redo', () => {
  const defaultProps = {
    googleMapsInstance: createFakeMapInstance(),
    translate: x => x,

    hasMapMoveSinceLastRefine: false,
    refineWithInstance: () => {},
  };

  it('expect to render correctly', () => {
    const props = {
      ...defaultProps,
    };

    const wrapper = shallow();
github youzan / zent / packages / zent / __tests__ / input.js View on Github external
import React from 'react';
import Enzyme, { mount } from 'enzyme';
import Adapter from 'enzyme-adapter-react-16';
import Input from 'input';

Enzyme.configure({ adapter: new Adapter() });

describe('Input', () => {
  beforeAll(() => {
    window.getSelection = function() {
      return 'autoSelect';
    };
  });

  it('will render div wrapper contains an input without any props', () => {
    const wrapper = mount(<input>);
    expect(wrapper.childAt(0).type()).toBe('div');
    expect(wrapper.childAt(0).hasClass('zent-input-wrapper')).toBe(true);
    expect(wrapper.find('div input').length).toBe(1);
    expect(wrapper.find('span').exists()).toBe(false);
  });
github SpareBank1 / designsystem / packages / ffe-datepicker-react / src / util / test-setup.js View on Github external
import { JSDOM } from 'jsdom';
import chai from 'chai';
import sinonChai from 'sinon-chai';
import chaiEnzyme from 'chai-enzyme';
import Enzyme from 'enzyme';
import Adapter from 'enzyme-adapter-react-16';

chai.use(chaiEnzyme());
chai.use(sinonChai);

global.window = new JSDOM('').window;
global.document = global.window.document;

Enzyme.configure({ adapter: new Adapter() });
github bluedaniel / Kakapo-app / __tests__ / src / components / soundEdit.spec.js View on Github external
import React from 'react';
import Enzyme, { shallow } from 'enzyme';
import Adapter from 'enzyme-adapter-react-16';
import { map } from 'ramda';
import { notifyActions, soundActions } from 'actions/';
import { SoundEdit } from 'components/';
import { newSoundObj } from 'utils/';
import { getData, createComponentWithIntl, mockEvent } from '../helper';

Enzyme.configure({ adapter: new Adapter() });

function setup(props = {}) {
  const propData = {
    ...getData('themes'),
    soundActions: {},
    ...props,
  };
  const comp = ;
  return {
    props,
    wrapper: shallow(comp),
    tree: createComponentWithIntl(comp).toJSON(),
  };
}

const soundProp = (props = {}) =&gt; {
github freeCodeCamp / pantry-for-good / client / components / error / ErrorWrapper.spec.js View on Github external
import React from 'react'
import Enzyme, {shallow} from 'enzyme'
import Adapter from 'enzyme-adapter-react-15'

Enzyme.configure({adapter: new Adapter()})

import ErrorWrapper from './ErrorWrapper'
import Error from './Error'

describe('ErrorWrapper', function() {
  it('wrapper', function() {
    const wrapper = shallow(
      
        foo
      
    )
    expect(wrapper.childAt(0).find(Error)).to.be.present()
    expect(wrapper.childAt(1)).to.have.text('foo')
    expect(wrapper.childAt(2).find(Error)).to.be.present()
  })
github deverlabs / grappe / webconfig / tools / jest / setup.js View on Github external
import Enzyme from 'enzyme';
import Adapter from 'enzyme-adapter-react-16';

Enzyme.configure({ adapter: new Adapter() });