New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

enzyme-dive

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

enzyme-dive

#### 1. Add Package ```typescript yarn add enzyme-dive --dev ```

  • 1.1.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1
Maintainers
1
Weekly downloads
 
Created
Source

🏊🏼‍♂ Dive deep️

Installation

1. Add Package
yarn add enzyme-dive --dev
2. Extend Enzyme in your setup file
import * as Enzyme from 'enzyme';
import Adapter from 'enzyme-adapter-react-xx';
import configure from "enzyme-dive";

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

// The magic 🧙🏼‍♂️
configure(Enzyme.ShallowWrapper);

Usage

diveTo(selector)

Use this to dive until you reach your component. This can be useful if you've got many HoC wrappers.

import React from 'react';
import { shallow } from "enzyme";
import Component from './Component';
import ChildComponent from './ChildComponent';

describe('<Component />', function() {
  it("should render child", () => {
      const wrapper = shallow(<Component />).diveTo(ChildComponent);

      expect(wrapper).toMatchSnapshot();
  });
});

diveDeep(depth)

Dive through your nodes a specified amount

import React from 'react';
import { shallow } from "enzyme";
import Component from './Component';

describe('<Component />', function() {
  it("should render", () => {
      // const wrapper = shallow(<Component />).dive().dive().dive().dive().dive();
      const wrapper = shallow(<Component />).diveDeep(5);

      expect(wrapper).toMatchSnapshot();
  });
});

FAQs

Package last updated on 23 Jan 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc