@samitouri / QOS-React / commits / 4fcc9184ac

Test :Add a small test for ReactTestUtils to find rendered component with type in document (#24368)

I tried to write test for the ReactTestUtils to find rendered component with type in document Tests before this PR ![Windows PowerShell 4_13_2022 11_35_24 PM](https://user-images.githubusercontent.com/72331432/163243620-40eb753c-4136-4793-a628-efcf9e004562.png) Tests after this PR ![Windows PowerShell 4_13_2022 11_35_30 PM](https://user-images.githubusercontent.com/72331432/163244704-cd17f0e3-7289-4794-895a-be03753e46de.png)

BIKI DAS committed Feb 17, 2023 at 16:53 UTC 4fcc9184ac2662186cbf1470005bf2b7c67dd40b
1 file changed +15
packages/react-dom/src/__tests__/ReactTestUtils-test.js
+15
@@ -463,4 +463,19 @@ describe('ReactTestUtils', () => {
463 ReactTestUtils.renderIntoDocument(<Component />);
464 expect(mockArgs.length).toEqual(0);
465 });
466 + it('should find rendered component with type in document', () => {
467 + class MyComponent extends React.Component {
468 + render() {
469 + return true;
470 + }
471 + }
472 +
473 + const instance = ReactTestUtils.renderIntoDocument(<MyComponent />);
474 + const renderedComponentType = ReactTestUtils.findRenderedComponentWithType(
475 + instance,
476 + MyComponent,
477 + );
478 +
479 + expect(renderedComponentType).toBe(instance);
480 + });
481 });