Skip to content

I can't call findByType on an instance (react-test-renderer) #13345

@aslanovsergey

Description

@aslanovsergey

Bug

What is the current behavior?
I can't call findByType() on an instance

    TypeError: instance.findByType is not a function

      140 |
      141 |         let instance = testRenderer.getInstance();
    > 142 |         let fieldMapper = instance.findByType(FieldMapper)

What is the expected behavior?
I want to get FieldMapper componen which is a child of FieldMapping

This is the peace of code from the test

        testRenderer = create(
            <Provider store={store}>
                <FieldMapping
                    setStage={(stage: number) => { }}
                    spDataProvider={null}
                    msFlowApprovalUrl=""
                ></FieldMapping>
            </Provider>
        );

        let instance = testRenderer.getInstance();
        let fieldMapper = instance.findByType(FieldMapper)

Which versions of React, and which browser / OS are affected by this issue? Did this work in previous versions of React?
React 15.6.2
react-test-renderer 15.6.2
Typescript 2.4.2
@types/react-test-renderer 16.0.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions