Skip to content
This repository has been archived by the owner on Jan 11, 2023. It is now read-only.

Commit

Permalink
Extract temp variables for wrapped components in their tests (#4279)
Browse files Browse the repository at this point in the history
  • Loading branch information
ahuth authored and jasonLaster committed Oct 4, 2017
1 parent 6563978 commit 0004098
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/components/Editor/tests/Breakpoints.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import { shallow } from "enzyme";
import Breakpoints from "../Breakpoints";
import * as I from "immutable";

const BreakpointsComponent = Breakpoints.WrappedComponent;

function generateDefaults(overrides) {
const sourceId = "server1.conn1.child1/source1";
const matchingBreakpoints = { id1: { location: { sourceId } } };
Expand All @@ -21,7 +23,7 @@ function generateDefaults(overrides) {

function render(overrides = {}) {
const props = generateDefaults(overrides);
const component = shallow(<Breakpoints.WrappedComponent {...props} />);
const component = shallow(<BreakpointsComponent {...props} />);
return { component, props };
}

Expand Down
4 changes: 3 additions & 1 deletion src/components/Editor/tests/SearchBar.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import SearchBar from "../SearchBar";
import "../../../workers/search";
import "../../../utils/editor";

const SearchBarComponent = SearchBar.WrappedComponent;

jest.mock("../../../workers/search", () => ({
getMatches: () => Promise.resolve(["result"])
}));
Expand Down Expand Up @@ -37,7 +39,7 @@ function generateDefaults() {
function render(overrides = {}) {
const defaults = generateDefaults();
const props = { ...defaults, ...overrides };
const component = shallow(<SearchBar.WrappedComponent {...props} />);
const component = shallow(<SearchBarComponent {...props} />);
return { component, props };
}

Expand Down

0 comments on commit 0004098

Please sign in to comment.