Skip to content

Unable to find node on an unmounted component. #390

@Doaa-Ismael

Description

@Doaa-Ismael

I wrote this test and it worked perfectly

describe('test', () => {
    it( 'should render all text', () => {
       const {getByText, getByTestId, debug} = render(
          <View>
            <View><Text>test1</Text></View>
            <View><Text>test2</Text></View>
            <View><Text>test3</Text></View>
          </View>
      });
});

I wanted to test each text alone so I edited the code to be like this .. I expected to work but it gave me this error

describe('test', () => {
      const {getByText, debug} = render(
          <View>
            <View><Text>test1</Text></View>
            <View><Text>test2</Text></View>
            <View><Text>test3</Text></View>
          </View>
      });
   it('should render test1', () => {
       debug();
        expect(getByText('test1')).toBeTruthy();
    });

   it('should render test2', () => {
       debug(); // return null
        expect(getByText('test2')).toBeTruthy(); // fails
    });

   it('should render test13, () => {
       debug(); // return null
        expect(getByText('test3')).toBeTruthy(); // fails
    });
});

Versions

npmPackages:
react: 16.9.0 => 16.9.0
react-native: 0.61.5 => 0.61.5
react-native-testing-library: ^1.13.0 => 1.13.0
react-test-renderer: ^16.13.1 => 16.13.1

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