Skip to content

Commit

Permalink
test(react): add additional displayName test cases for withErrorBound…
Browse files Browse the repository at this point in the history
…aryGroup (#167)
  • Loading branch information
tooooo1 authored Sep 24, 2023
1 parent 83e8244 commit 1ca8054
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions packages/react/src/ErrorBoundaryGroup.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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)')
})
})

1 comment on commit 1ca8054

@vercel
Copy link

@vercel vercel bot commented on 1ca8054 Sep 24, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

visualization – ./websites/visualization

visualization-suspensive.vercel.app
visualization.suspensive.org
visualization-git-main-suspensive.vercel.app

Please sign in to comment.