@samitouri / QOS-React / commits / c35b9b05fe

Fix ReactHooksInspection-test.js (#28520)

## Summary Currently, `ReactHooksInspection-test.js` fails because something is polluting the resulting `Promise` with symbol properties. This changes the unit test to be more resilient to such symbol properties. ## How did you test this change? Ran the following successfully: ``` $ yarn test ```

Timothy Yung committed Mar 7, 2024 at 11:22 UTC c35b9b05fee039a8c3a99fdb7e35d5ca30db9eb0
1 file changed +22 -17
packages/react-debug-tools/src/__tests__/ReactHooksInspection-test.js
+22 -17
@@ -584,24 +584,29 @@ describe('ReactHooksInspection', () => {
584 return <div>{value}</div>;
585 }
586 const tree = ReactDebugTools.inspectHooks(Foo, {});
587 - expect(normalizeSourceLoc(tree)).toMatchInlineSnapshot(`
588 - [
589 - {
590 - "debugInfo": null,
591 - "hookSource": {
592 - "columnNumber": 0,
593 - "fileName": "**",
594 - "functionName": "Foo",
595 - "lineNumber": 0,
596 - },
597 - "id": null,
598 - "isStateEditable": false,
599 - "name": "Unresolved",
600 - "subHooks": [],
601 - "value": Promise {},
587 + const results = normalizeSourceLoc(tree);
588 + expect(results).toHaveLength(1);
589 + expect(results[0]).toMatchInlineSnapshot(
590 + {
591 + value: expect.any(Promise),
592 + },
593 + `
594 + {
595 + "debugInfo": null,
596 + "hookSource": {
597 + "columnNumber": 0,
598 + "fileName": "**",
599 + "functionName": "Foo",
600 + "lineNumber": 0,
601 },
603 - ]
604 - `);
602 + "id": null,
603 + "isStateEditable": false,
604 + "name": "Unresolved",
605 + "subHooks": [],
606 + "value": Any<Promise>,
607 + }
608 + `,
609 + );
610 });
611
612 describe('useDebugValue', () => {