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.; // <-- side-effects!!!
Or, with something like Mockery, do:
;; mockery;mockery;
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"; ;