Skip to content

Commit

Permalink
use merge-deep to merge props
Browse files Browse the repository at this point in the history
  • Loading branch information
Raice Hannay committed Dec 11, 2019
1 parent e0cf9b1 commit 5d4266d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"author": "Raice Hannay <voodoocreation@gmail.com>",
"description": "A set of classes to make setting up React components for unit tests easy.",
"license": "ISC",
"version": "1.0.2",
"version": "1.0.3",
"keywords": [
"component",
"enzyme",
Expand Down
9 changes: 4 additions & 5 deletions src/Wrapper.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { ComponentType, mount, render, shallow } from "enzyme";
import merge from "merge-deep";
import * as React from "react";

export default class Wrapper<
Expand Down Expand Up @@ -95,11 +96,9 @@ export default class Wrapper<
};

protected defineProps = () => {
this.mergedProps = {
children: this.scenarioChildren || this.defaultChildren,
...this.defaultProps,
...this.scenarioProps
};
this.mergedProps = merge({}, this.defaultProps, this.scenarioProps, {
children: this.scenarioChildren || this.defaultChildren
});

return this.mergedProps;
};
Expand Down

0 comments on commit 5d4266d

Please sign in to comment.