From 1ca80549e27c94c199b909b09789fd0b2d543fb9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=A0=95=EC=B6=A9=EC=9D=BC?= Date: Sun, 24 Sep 2023 13:29:47 +0900 Subject: [PATCH] test(react): add additional displayName test cases for withErrorBoundaryGroup (#167) --- packages/react/src/ErrorBoundaryGroup.spec.tsx | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/packages/react/src/ErrorBoundaryGroup.spec.tsx b/packages/react/src/ErrorBoundaryGroup.spec.tsx index 25b9c29a9..50eecef5a 100644 --- a/packages/react/src/ErrorBoundaryGroup.spec.tsx +++ b/packages/react/src/ErrorBoundaryGroup.spec.tsx @@ -84,4 +84,15 @@ describe('withErrorBoundaryGroup', () => { const rendered = render(createElement(withErrorBoundaryGroup(UsingUseErrorBoundary))) expect(rendered.queryByText(TEXT)).toBeInTheDocument() }) + + it('should set displayName based on Component.displayName', () => { + const TestComponentWithDisplayName = () => <>{TEXT} + TestComponentWithDisplayName.displayName = 'TestDisplayName' + + expect(withErrorBoundaryGroup(TestComponentWithDisplayName).displayName).toBe( + 'withErrorBoundaryGroup(TestDisplayName)' + ) + + expect(withErrorBoundaryGroup(() => <>{TEXT}).displayName).toBe('withErrorBoundaryGroup(Component)') + }) })