How to use the enzyme-adapter-react-15 function in enzyme-adapter-react-15

To help you get started, we’ve selected a few enzyme-adapter-react-15 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 poanetwork / token-wizard / test / components / Crowdsales / index.spec.js View on Github external
import React from 'react'
import Adapter from 'enzyme-adapter-react-15'
import { configure, shallow, mount } from 'enzyme'
import { Crowdsales } from '../../../src/components/Crowdsales'
import { CrowdsalesList } from '../../../src/components/Crowdsales/CrowdsalesList'
import { crowdsaleStore, contractStore, web3Store, generalStore } from '../../../src/stores'
import { Provider } from 'mobx-react'
import renderer from 'react-test-renderer'

configure({ adapter: new Adapter() })

describe('Crowdsales', () => {
  const stores = { crowdsaleStore, web3Store, generalStore, contractStore }

  it('should render screen ', () => {
    // Given
    const tree = renderer.create(
      
        
      
    )

    // When
    const treeJson = tree.toJSON()

    // Then
github coralproject / talk / test / client / setupJest.js View on Github external
import Enzyme from 'enzyme';
import Adapter from 'enzyme-adapter-react-15';

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

// Storage Mock

// TODO: Some places in our code (e.g. translations) has a hardcoded dependency
// to the local storage. Fixing it and we can remove this global mock.

function storageMock() {
  let storage = {};

  return {
    setItem: function(key, value) {
      storage[key] = value || '';
    },
    getItem: function(key) {
      return key in storage ? storage[key] : null;
    },
github OpusCapita / fsm-workflow / packages / editor / src / components / TopForm.spec.js View on Github external
import React from 'react';
import { expect } from 'chai';
import Enzyme from 'enzyme';
import Adapter from 'enzyme-adapter-react-15';
import { mount } from 'enzyme';
import sinon from 'sinon';
import FormControl from 'react-bootstrap/lib/FormControl';
import TopForm from './TopForm.react';
import { I18nManager } from '@opuscapita/i18n';

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

describe('', () => {
  it('renders top form', () => {
    const props = {
      name: 'Invoice workflow',
      onNameChange: sinon.spy()
    };

    const wrapper = mount(, { context: { i18n: new I18nManager() } });
    expect(wrapper).to.exist; // eslint-disable-line no-unused-expressions
    expect(wrapper.contains(FormControl)).to.be.true; // eslint-disable-line no-unused-expressions
    expect(wrapper.find(FormControl).prop('value')).to.equal(props.name);
    expect(wrapper.find(FormControl).prop('onChange')).to.equal(props.onNameChange);
  });
});
github pivotal-cf / pivotal-ui / styleguide / spec / support / matchers / jest_react.js View on Github external
import React from 'react';
import {configure as configureEnzyme, mount} from 'enzyme';
import Adapter from 'enzyme-adapter-react-15';
configureEnzyme({adapter: new Adapter()});
import {matcherResult} from './common';
import jestDiff from 'jest-diff';

const root = document.createElement('div');
document.body.appendChild(root);

let lastRendered;
const testRender = element => {
  lastRendered = mount(element, {attachTo: root});
  // eslint-disable-next-line no-console
  lastRendered.print = () => console.log(lastRendered.debug());
  return lastRendered;
};

const testReset = () => {
  lastRendered && lastRendered.unmount();
github rnosov / react-reveal / __tests__ / in-and-out / Bounce.js View on Github external
/*
 * Bounce Component Test Suite
 *
 * Copyright © Roman Nosov 2016
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE.txt file in the root directory of this source tree.
 */
import Bounce from '../../Bounce';

import React from 'react';
import { shallow } from 'enzyme';
import { configure } from 'enzyme';
import Adapter from 'enzyme-adapter-react-15';

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

describe('Bounce', () => {
  it('renders a initial view', () => {
    const content = shallow(
      
        <div>Test test</div>
      
    );
    expect(content.html()).toMatchSnapshot();
  });
});
github poanetwork / token-wizard / test / components / Manage / index.spec.js View on Github external
import { MemoryRouter } from 'react-router'
import { Manage } from '../../../src/components/Manage/index'
import {
  crowdsaleStore,
  web3Store,
  tierStore,
  contractStore,
  reservedTokenStore,
  stepTwoValidationStore,
  generalStore,
  tokenStore,
  gasPriceStore,
  deploymentStore
} from '../../../src/stores'

configure({ adapter: new Adapter() })

describe('Manage index', () => {
  const stores = {
    crowdsaleStore,
    web3Store,
    tierStore,
    contractStore,
    reservedTokenStore,
    stepTwoValidationStore,
    generalStore,
    tokenStore,
    gasPriceStore,
    deploymentStore
  }

  it(`should render Manage`, () => {
github poanetwork / token-wizard / test / components / Common / Error.spec.js View on Github external
import React from 'react'
import { Error } from '../../../src/components/Common/Errors'
import { Form } from 'react-final-form'
import Adapter from 'enzyme-adapter-react-15'
import { configure, mount, shallow } from 'enzyme'
import renderer from 'react-test-renderer'
import { FORM_ERROR } from 'final-form'
import {validateTierMinCap} from "../../../src/utils/validations";

configure({ adapter: new Adapter() })

describe('Error ', () => {

  const errorStyle = {
    color: 'blue',
    fontWeight: 'bold',
    fontSize: '24px',
    width: '50%',
    height: '10px'
  }


  it(`should render Error component`, () => {
    const getErrors = () =>{
      return FORM_ERROR
    }
github freeCodeCamp / pantry-for-good / client / modules / food / components / inventory / FoodItems.spec.js View on Github external
import React from 'react'
import Enzyme, { mount, shallow } from 'enzyme'
import Adapter from 'enzyme-adapter-react-15'
import { Button, Modal } from 'react-bootstrap'
import { normalize } from 'normalizr'

import { arrayOfFoodItems, arrayOfFoodCategories } from '../../../../../common/schemas'
import ConnectedFoodItems, { FoodItems } from './FoodItems'
import { saveFoodItem, deleteFoodItem, clearFlags } from '../../reducers/item'
import { showConfirmDialog, hideDialog } from '../../../core/reducers/dialog'

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

describe('FoodItems', () =&gt; {
  let props

  beforeEach(() =&gt; {
    props = {
      foodItems: [],
      foodCategories: [],
      clearFlags: sinon.spy()
    }
  })

  it('sets state when constructed', () =&gt; {
    const wrapper = shallow()
    expect(wrapper.state().modalType).to.equal(undefined)
    expect(wrapper.state().editModalFood).to.equal(undefined)
github freeCodeCamp / pantry-for-good / client / components / form / FieldGroup.spec.js View on Github external
import React from 'react'
import Enzyme, {shallow} from 'enzyme'
import Adapter from 'enzyme-adapter-react-15'
import {
  ControlLabel,
  FormControl,
  FormGroup,
  Glyphicon,
  HelpBlock,
  Radio
} from 'react-bootstrap'

import FieldGroup from './FieldGroup'
import Checkbox from './Checkbox'

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

describe('FieldGroup', function() {
  it('renders an input', function() {
    const wrapper = shallow()

    expect(wrapper.find(FormGroup)).to.be.present()
    expect(wrapper.find(FormGroup)).to.have.prop('controlId', 'foo')
    expect(wrapper.find(FormControl)).to.be.present()
    expect(wrapper.find(FormControl)).to.have.prop('name', 'foo')
  })

  it('renders a label', function() {
    const wrapper = shallow()

    expect(wrapper.find(ControlLabel).childAt(0)).to.have.text('Foo')
  })

enzyme-adapter-react-15

JavaScript Testing utilities for React

MIT
Latest version published 1 year ago

Package Health Score

71 / 100
Full package analysis

Popular enzyme-adapter-react-15 functions