Name: react-native-svg-mock
Owner: Formidable
Description: A mock implementation of react-native-svg for use in tests
Created: 2016-08-10 20:13:51.0
Updated: 2017-12-15 01:31:23.0
Pushed: 2017-11-10 01:12:37.0
Size: 68
Language: JavaScript
GitHub Committers
User | Most Recent Commit | # Commits |
---|
Other Committers
User | Most Recent Commit | # Commits |
---|
A mock implementation of react-native-svg for use in tests. Inspired by react-native-mock.
With npm, do:
install react-native-svg-mock --save-dev
ile-that-runs-before-all-of-my-tests.js */
his will mutate `react-native-svg`'s require cache with `react-native-svg-mock`'s.
ire('react-native-svg-mock/mock'); // <-- side-effects!!!
Or, with something like Mockery, do:
rt mockery from "mockery";
rt reactNativeSvgMock from "react-native-svg-mock";
ery.enable();
ery.registerMock("react-native-svg", reactNativeSvgMock);
In a test with Enzyme and Mocha, this could look like:
rt "react-native-mock/mock";
rt "react-native-svg-mock/mock";
rt { render } from "enzyme";
rt { expect } from "chai";
rt { VictoryChart } from "victory-native";
ribe("<VictoryChart />", function () {
("should render", function () {
var component = render(<VictoryChart />);
expect(component).to.have.length(1);
;