New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

react-native-svg-mock

Package Overview
Dependencies
Maintainers
22
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-native-svg-mock

A mock implementation of react-native-svg for use in tests.

latest
Source
npmnpm
Version
2.0.0
Version published
Maintainers
22
Created
Source

Build Status npm version

react-native-svg-mock

A mock implementation of react-native-svg for use in tests. Inspired by react-native-mock.

Install

With npm, do:

npm install react-native-svg-mock --save-dev

Usage

/* file-that-runs-before-all-of-my-tests.js */

// This will mutate `react-native-svg`'s require cache with `react-native-svg-mock`'s.
require('react-native-svg-mock/mock'); // <-- side-effects!!!

Or, with something like Mockery, do:

import mockery from "mockery";
import reactNativeSvgMock from "react-native-svg-mock";

mockery.enable();
mockery.registerMock("react-native-svg", reactNativeSvgMock);

In a test with Enzyme and Mocha, this could look like:

import "react-native-mock/mock";
import "react-native-svg-mock/mock";

import { render } from "enzyme";
import { expect } from "chai";

import { VictoryChart } from "victory-native";

describe("<VictoryChart />", function () {
  it("should render", function () {
    var component = render(<VictoryChart />);
    expect(component).to.have.length(1);
  });
});

Keywords

react

FAQs

Package last updated on 10 Nov 2017

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