How to use the enzyme-adapter-react-16/build 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 mozilla / treeherder / tests / ui / test-setup.js View on Github external
// Entry point for Jest tests
import { configure } from 'enzyme/build';
import Adapter from 'enzyme-adapter-react-16/build';
import '@testing-library/jest-dom/extend-expect';

configure({ adapter: new Adapter() });
github ncrmro / aeon / jestSetup.js View on Github external
import Enzyme, { shallow, render, mount } from 'enzyme/build'
import Adapter from 'enzyme-adapter-react-16/build'
// React 16 Enzyme adapter
Enzyme.configure({ adapter: new Adapter() })
// Make Enzyme functions available in all test files without importing
global.shallow = shallow
global.render = render
global.mount = mount
github mytardis / mytardis / assets / js / apps / search / __tests__ / search.spec.jsx View on Github external
import React from 'react';
import { configure, shallow } from 'enzyme/build';
import Adapter from 'enzyme-adapter-react-16/build';
import Search, {
  createDataFileResultData,
  createDatasetResultData,
  createExperimentResultData,
} from '../components/Search';
import Result from '../components/Result';
import Results from '../components/Results';
import SimpleSearchForm from '../components/SimpleSearchForm';
import AdvancedSearchForm from '../components/AdvancedSearchForm';

global.fetch = require('jest-fetch-mock');

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

const experimentData = {
  title: 'Test Group - Test Experiment 1',
  description: 'Uploader: Test Instrument',
  type: 'experiment',
  id: '8369',
  url: '/experiment/view/8369/',
};
const datasetData = {
  title: 'Test Dataset',
  type: 'dataset',
  id: 1234,
  url: '/dataset/1234',
  experiments: [],
  instrument: 'Test Instrument',
  created_time: '2017-02-02T00:20:35.882945+00:00',
github microsoft / fast-dna / packages / fast-components-react-msft / src / action-trigger / action-trigger.spec.tsx View on Github external
import { configure, mount, shallow } from "enzyme";
import MSFTActionTrigger, {
    ActionTriggerAppearance,
    ActionTriggerHandledProps,
    ActionTriggerManagedClasses,
    ActionTriggerProps,
    ActionTriggerUnhandledProps,
} from "./action-trigger";
import { ActionTrigger } from "./index";
import { ActionTriggerClassNameContract } from "@microsoft/fast-components-class-name-contracts-msft";
import { DisplayNamePrefix } from "../utilities";

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

describe("action trigger", (): void => {
    const managedClasses: ActionTriggerClassNameContract = {
        actionTrigger: "action-trigger",
        actionTrigger_glyph: "glyph",
        actionTrigger__justified: "action-trigger-justified",
        actionTrigger__lightweight: "action-trigger-lightweight",
        actionTrigger__outline: "action-trigger-outline",
        actionTrigger__primary: "action-trigger-primary",
        actionTrigger__stealth: "action-trigger-stealth",
        actionTrigger__disabled: "action-trigger-disabled",
        actionTrigger__hasGlyphAndContent: "action-trigger-has-glyph-and-content",
    };
    const href: string = "#";

    test("should have a displayName that matches the component name", () => {
github microsoft / fast-dna / packages / fast-components-react-msft / src / background / background.spec.tsx View on Github external
import React from "react";
import Background from "./background";
import * as ShallowRenderer from "react-test-renderer/shallow";
import Adapter from "enzyme-adapter-react-16/build";
import { configure, mount, shallow } from "enzyme";
import {
    DesignSystem,
    DesignSystemDefaults,
} from "@microsoft/fast-components-styles-msft";
import { DesignSystemProvider } from "@microsoft/fast-jss-manager-react";

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

describe("Background", (): void => {
    test("should not throw", (): void => {
        expect(
            (): void => {
                mount();
            }
        ).not.toThrow();
    });
    test("should create a div by default", (): void => {
        expect(mount().find("div")).toHaveLength(1);
    });
    test("should not create a div with tag = null", (): void => {
        expect(mount().find("div")).toHaveLength(0);
    });
    test("should accept unhandled props", (): void => {
github microsoft / fast-dna / packages / fast-components-react-msft / src / call-to-action / call-to-action.spec.tsx View on Github external
import { configure, mount, shallow } from "enzyme";
import MSFTCallToAction, {
    CallToActionAppearance,
    CallToActionHandledProps,
    CallToActionManagedClasses,
    CallToActionProps,
    CallToActionUnhandledProps,
} from "./call-to-action";
import { CallToAction } from "./index";
import { CallToActionClassNameContract } from "@microsoft/fast-components-class-name-contracts-msft";
import { DisplayNamePrefix } from "../utilities";

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

describe("call to action", (): void => {
    const managedClasses: CallToActionClassNameContract = {
        callToAction: "call-to-action",
        callToAction_glyph: "glyph",
        callToAction__justified: "call-to-action-justified",
        callToAction__lightweight: "call-to-action-lightweight",
        callToAction__outline: "call-to-action-outline",
        callToAction__primary: "call-to-action-primary",
        callToAction__stealth: "call-to-action-stealth",
        callToAction__disabled: "call-to-action-disabled",
    };
    const href: string = "#";

    test("should have a displayName that matches the component name", () => {
        expect(`${DisplayNamePrefix}${(MSFTCallToAction as any).name}`).toBe(
github microsoft / fast-dna / packages / fast-components-react-msft / src / action-toggle / action-toggle.spec.tsx View on Github external
import { configure, mount, shallow } from "enzyme";
import MSFTActionToggle, {
    ActionToggleAppearance,
    ActionToggleHandledProps,
    ActionToggleManagedClasses,
    ActionToggleProps,
    ActionToggleUnhandledProps,
} from "./action-toggle";
import { ActionToggle } from "./index";
import { ActionToggleClassNameContract } from "@microsoft/fast-components-class-name-contracts-msft";
import { DisplayNamePrefix } from "../utilities";

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

describe("action toggle", (): void => {
    const href: string = "#";
    const classes: ActionToggleClassNameContract = {
        actionToggle: "actionToggle",
        actionToggle__justified: "actionToggle__justified",
        actionToggle__lightweight: "actionToggle__lightweight",
        actionToggle__outline: "actionToggle__outline",
        actionToggle__primary: "actionToggle__primary",
        actionToggle__stealth: "actionToggle__stealth",
        actionToggle__disabled: "actionToggle__disabled",
        actionToggle__selected: "actionToggle__selected",
    };

    test("should have a displayName that matches the component name", () => {
        expect(`${DisplayNamePrefix}${(MSFTActionToggle as any).name}`).toBe(
github jubianchi / semver-check / src / setupTests.js View on Github external
import Enzyme from 'enzyme/build';
import Adapter from 'enzyme-adapter-react-16/build';

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

enzyme-adapter-react-16

JavaScript Testing utilities for React

MIT
Latest version published 9 months ago

Package Health Score

81 / 100
Full package analysis