diff --git a/test/findNodeByName-basic.spec.tsx b/test/findNodeByName-basic.spec.tsx index dd51f61..9439f1d 100644 --- a/test/findNodeByName-basic.spec.tsx +++ b/test/findNodeByName-basic.spec.tsx @@ -94,5 +94,32 @@ describe("findNodeByComponentName", () => { expect((found as FiberNodeForComponentClass).stateNode).toBe(null); expect((found as FiberNodeForComponentClass).type.name).toBe(Fn2.name); }); + + it("should work for 5th-level function name", () => { + function Fn1() { + return ( +
+
+ + +
+
+ ); + } + + function Fn2() { + return Fn2 here; + } + + const WrappedC = getWrappedComponent(Fn1); + const rootNode = mountAndGetRootNode(WrappedC, container); + + const found = findNodeByComponentName(rootNode, Fn2.name); + + // Shouldn't be null, or other falsy value + expect(found).not.toBeFalsy(); + expect((found as FiberNodeForComponentClass).stateNode).toBe(null); + expect((found as FiberNodeForComponentClass).type.name).toBe(Fn2.name); + }); }); });