Skip to content

Commit 5d4266d

Browse files
author
Raice Hannay
committed
use merge-deep to merge props
1 parent e0cf9b1 commit 5d4266d

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"author": "Raice Hannay <[email protected]>",
44
"description": "A set of classes to make setting up React components for unit tests easy.",
55
"license": "ISC",
6-
"version": "1.0.2",
6+
"version": "1.0.3",
77
"keywords": [
88
"component",
99
"enzyme",

src/Wrapper.tsx

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { ComponentType, mount, render, shallow } from "enzyme";
2+
import merge from "merge-deep";
23
import * as React from "react";
34

45
export default class Wrapper<
@@ -95,11 +96,9 @@ export default class Wrapper<
9596
};
9697

9798
protected defineProps = () => {
98-
this.mergedProps = {
99-
children: this.scenarioChildren || this.defaultChildren,
100-
...this.defaultProps,
101-
...this.scenarioProps
102-
};
99+
this.mergedProps = merge({}, this.defaultProps, this.scenarioProps, {
100+
children: this.scenarioChildren || this.defaultChildren
101+
});
103102

104103
return this.mergedProps;
105104
};

0 commit comments

Comments
 (0)