-
Notifications
You must be signed in to change notification settings - Fork 26.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Hannes Bornö
committed
Mar 1, 2023
1 parent
5b94209
commit 3930e5e
Showing
2 changed files
with
37 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import { formatServerError } from './format-server-error' | ||
|
||
describe('formatServerError', () => { | ||
it('should not append message several times', () => { | ||
const err = new Error( | ||
'Class extends value undefined is not a constructor or null' | ||
) | ||
|
||
// Before | ||
expect(err.message).toMatchInlineSnapshot( | ||
`"Class extends value undefined is not a constructor or null"` | ||
) | ||
|
||
// After | ||
formatServerError(err) | ||
expect(err.message).toMatchInlineSnapshot(` | ||
"Class extends value undefined is not a constructor or null | ||
This might be caused by a React Class Component being rendered in a Server Component, React Class Components only works in Client Components. Read more: https://nextjs.org/docs/messages/class-component-in-server-component" | ||
`) | ||
|
||
// After second | ||
formatServerError(err) | ||
expect(err.message).toMatchInlineSnapshot(` | ||
"Class extends value undefined is not a constructor or null | ||
This might be caused by a React Class Component being rendered in a Server Component, React Class Components only works in Client Components. Read more: https://nextjs.org/docs/messages/class-component-in-server-component" | ||
`) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters