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

To help you get started, we’ve selected a few enzyme-adapter-react-16 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 sulu / sulu / tests / js / testSetup.config.js View on Github external
// @flow
import Enzyme from 'enzyme';
import Adapter from 'enzyme-adapter-react-16';

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

jest.mock('sulu-admin-bundle/services/Config', () => ({
    endpoints: {
        'config': 'config_url',
        'translations': 'translations_url',
        'loginCheck': 'login_check_url',
        'logout': 'logout_url',
        'profileSettings': 'profile_settings_url',
        'forgotPasswordReset': 'forgot_password_reset_url',
        'resetPassword': 'reset_password',
        'resources': 'resources_url/:resource',
        'routing': 'routing',
    },
    translations: ['en', 'de'],
    fallbackLocale: 'en',
}));
github code-for-nashville / power-of-attorney / src / setupTests.js View on Github external
import Adapter from 'enzyme-adapter-react-16'
import Enzyme from 'enzyme'

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

jest.mock('react-i18next', () => ({
  __esModule: true,
  I18nextProvider: Component => Component.children,
  // this mock makes sure any components using the translate HoC receive the t function as a prop
  translate: () => Component => {
    Component.defaultProps = {...Component.defaultProps, t: () => ''}
    return Component
  }
}))
github codingblocks / qit.cloud / website / src / setupTests.js View on Github external
// This is a magical file that create-react-app and jest use for boilerplate config
// https://github.com/facebook/create-react-app/blob/master/packages/react-scripts/template/README.md#initializing-test-environment
import { configure } from 'enzyme'
import Adapter from 'enzyme-adapter-react-16'

configure({ adapter: new Adapter() })
github YDJ-FE / steamer-react-ts / test / spec / simple.spec.tsx View on Github external
import { shallow, configure } from 'enzyme'
import Adapter from 'enzyme-adapter-react-16'
import React from 'react'

configure({ adapter: new Adapter() })

test('simple test', () => {
  expect(shallow(<div>).type()).toBe('div')
})
</div>
github inkandswitch / pushpin / test / board.jsx View on Github external
import assert from 'assert'
import { configure, mount } from 'enzyme'
import Adapter from 'enzyme-adapter-react-16'
import * as React from 'react'

import Board from '../src/renderer/components/board/board'

configure({ adapter: new Adapter() })

describe('', () =&gt; {
  describe('should be instantiable', () =&gt; {
    const props = {
      cards: [{
        type: 'text',
        id: 'imaginary-card-id',
        x: 0,
        y: 0,
        height: 10,
        width: 24,
        text: ''
      }],
      backgroundColor: '#fff',
      selected: ['imaginary-card-id']
    }
github peterpalau / react-bnb-gallery / tests / setup.js View on Github external
import Enzyme from 'enzyme';
import Adapter from 'enzyme-adapter-react-16';

import 'jest-enzyme';

Enzyme.configure({ adapter: new Adapter() });
github algolia / react-instantsearch / packages / react-instantsearch-dom-maps / src / __tests__ / CustomMarker.js View on Github external
import React from 'react';
import ReactDOM from 'react-dom';
import Enzyme, { mount, shallow } from 'enzyme';
import Adapter from 'enzyme-adapter-react-16';
import {
  createFakeGoogleReference,
  createFakeMapInstance,
  createFakeHTMLMarkerInstance,
} from '../../test/mockGoogleMaps';
import createHTMLMarker from '../elements/createHTMLMarker';
import * as utils from '../utils';
import Connected, { CustomMarker } from '../CustomMarker';

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

jest.mock('../elements/createHTMLMarker', () => jest.fn());

jest.mock('../utils');

describe('CustomMarker', () => {
  const defaultProps = {
    hit: {
      _geoloc: {
        lat: 10,
        lng: 12,
      },
    },
  };

  beforeEach(() => {
github deepfunc / react-test-demo / __tests__ / setup / enzyme-setup.js View on Github external
import { configure } from 'enzyme';
import Adapter from 'enzyme-adapter-react-16';

configure({ adapter: new Adapter() });
github aichbauer / react-table-kit / test / components / Table.spec.js View on Github external
import React from 'react';
import renderer from 'react-test-renderer';
import Adapter from 'enzyme-adapter-react-16';
import { configure, mount } from 'enzyme';

import { Table } from '../../src/components/Table';

import { sortSearchColumns, noHeaderColumns } from '../fixtures/columns';
import { data, noDataFound } from '../fixtures/data';

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

const MyComponent = (
  }
    columns={sortSearchColumns}
    data={data}
    exportCSV
    inputColumnSearch={<input placeholder="Search column test" type="text"><input placeholder="Search table test" type="text"><table value="Export CSV test"></table>}
    inputTableSearch={}
    table={}
    tableSearch="exact"
    td={}
    trHead={}
  /&gt;<table><tbody><tr><td>}
    th={</td><td>}
    trBody={</td></tr><tr></tr><tr></tr></tbody></table>
github microsoft / fast-dna / packages / fast-tooling-react / src / css-editor / editor.spec.tsx View on Github external
import React from "react";
import Adapter from "enzyme-adapter-react-16";
import { configure, mount, shallow } from "enzyme";
import Editor from "./editor";
import { CSSEditor, PositionValue, SpacingType } from "./";
import { SpacingProperty } from "./spacing";
import { CSSEditorValues } from "./editor.props";

/**
 * Configure Enzyme
 */
configure({ adapter: new Adapter() });

describe("CSSEditor", () =&gt; {
    test("should not throw", () =&gt; {
        expect(() =&gt; {
            shallow();
        }).not.toThrow();
    });
    test("should have a displayName that matches the component name", () =&gt; {
        expect((Editor as any).name).toBe(Editor.displayName);
    });
    test("should implement the CSSPosition component", () =&gt; {
        const rendered: any = mount();

        expect(rendered.find("CSSPosition").length).toBe(1);
    });
    test("should pass all position props to the CSSPosition component", () =&gt; {

enzyme-adapter-react-16

JavaScript Testing utilities for React

MIT
Latest version published 4 months ago

Package Health Score

89 / 100
Full package analysis