Skip to content
This repository has been archived by the owner on Jul 9, 2019. It is now read-only.

Commit

Permalink
mocked victory
Browse files Browse the repository at this point in the history
  • Loading branch information
JakeDawkins committed Dec 16, 2016
1 parent 7ce052e commit 41de873
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 15 deletions.
3 changes: 2 additions & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@
"Media": true,
"FormElement": true,
"SyntheticInputEvent": true,
"React$Element": true
"React$Element": true,
"jest": true,
},
"rules": {
"arrow-parens": [2, "always"],
Expand Down
14 changes: 14 additions & 0 deletions __mocks__/victory.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@

const VictoryChart = jest.fn(() => "VictoryChart");
const VictoryAxis = jest.fn(() => "VictoryAxis");
const VictoryLine = jest.fn(() => "VictoryLine");
const VictoryScatter = jest.fn(() => "VictoryScatter");
const VictoryArea = jest.fn(() => "VictoryArea");

export {
VictoryChart,
VictoryAxis,
VictoryLine,
VictoryScatter,
VictoryArea,
};
14 changes: 14 additions & 0 deletions imports/__mocks__/victory.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@

const VictoryChart = jest.fn(() => "VictoryChart");
const VictoryAxis = jest.fn(() => "VictoryAxis");
const VictoryLine = jest.fn(() => "VictoryLine");
const VictoryScatter = jest.fn(() => "VictoryScatter");
const VictoryArea = jest.fn(() => "VictoryArea");

export {
VictoryChart,
VictoryAxis,
VictoryLine,
VictoryScatter,
VictoryArea,
};
15 changes: 1 addition & 14 deletions imports/components/graphs/lineGraph/__tests__/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,7 @@ import { mount, shallow } from "enzyme";
import { mountToJson, shallowToJson } from "enzyme-to-json";
import LineGraph from "../";

jest.mock("victory", () => {
const VictoryChart = jest.fn(() => "VictoryChart");
const VictoryAxis = jest.fn(() => "VictoryAxis");
const VictoryLine = jest.fn(() => "VictoryLine");
const VictoryScatter = jest.fn(() => "VictoryScatter");
const VictoryArea = jest.fn(() => "VictoryArea");
return {
VictoryChart: VictoryChart,
VictoryAxis: VictoryAxis,
VictoryLine: VictoryLine,
VictoryScatter: VictoryScatter,
VictoryArea: VictoryArea,
};
});
jest.mock("victory");

const generateComponent = (additionalProps = {}) => {
const defaultProps = {
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
"moduleNameMapper": {
"^meteor/(.*)": "<rootDir>/.meteor/mocks/$1.js"
},
"mocksPattern": "(?:[\\/]|^)imports/__mocks__[\\/]",
"setupFiles": [
"<rootDir>/.scripts/before_test.js"
]
Expand Down

0 comments on commit 41de873

Please sign in to comment.