Fix usages on mountAndGetRootNode with function component

This commit is contained in:
2019-08-03 20:29:45 +05:30
parent b59b0c8fe2
commit dbea40b9f8
2 changed files with 47 additions and 33 deletions
+3 -10
View File
@@ -10,7 +10,6 @@ import { traverseGenerator } from "../src";
// Import test helpers and sample components
import { mountAndGetRootNode } from "./utils/mountInEnzyme";
import getWrappedComponent from './utils/getWrappedComponent';
import CDepth1 from "./sample-components/depth-1-simple";
import CDepth2 from "./sample-components/depth-2-simple";
import CDepth5 from "./sample-components/depth-5-simple";
@@ -63,9 +62,7 @@ describe("traverseGenerator", () => {
});
it("should work for depth=1 function", () => {
const WrappedC = getWrappedComponent(FnDepth1);
const rootNode = mountAndGetRootNode(WrappedC, container)
.child as FiberNodeForFunctionComponent;
const rootNode = mountAndGetRootNode(FnDepth1, container);
const nodeIterator = traverseGenerator(rootNode);
const nodes = [...nodeIterator];
@@ -86,9 +83,7 @@ describe("traverseGenerator", () => {
return <div>Fn2 here</div>;
}
const WrappedC = getWrappedComponent(Fn1);
const rootNode = mountAndGetRootNode(WrappedC, container)
.child as FiberNodeForFunctionComponent;
const rootNode = mountAndGetRootNode(Fn1, container);
const nodeIterator = traverseGenerator(rootNode);
const nodes = [...nodeIterator];
@@ -113,9 +108,7 @@ describe("traverseGenerator", () => {
return <div>Fn2 here</div>;
}
const WrappedC = getWrappedComponent(Fn1);
const rootNode = mountAndGetRootNode(WrappedC, container)
.child as FiberNodeForFunctionComponent;
const rootNode = mountAndGetRootNode(Fn1, container);
const nodeIterator = traverseGenerator(rootNode);
const nodes = [...nodeIterator];