From 5d4266db569d80e891454e00f92d6acf7af7c47f Mon Sep 17 00:00:00 2001 From: Raice Hannay Date: Thu, 12 Dec 2019 10:47:17 +1300 Subject: [PATCH] use merge-deep to merge props --- package.json | 2 +- src/Wrapper.tsx | 9 ++++----- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index cac317b..8d598c8 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,7 @@ "author": "Raice Hannay ", "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", diff --git a/src/Wrapper.tsx b/src/Wrapper.tsx index f1cf8b8..1825fa1 100644 --- a/src/Wrapper.tsx +++ b/src/Wrapper.tsx @@ -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< @@ -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; };