silverwolf-x/project / packages /next /src /lib /format-server-error.test.ts
silverwolf-x's picture
download
raw
1.19 kB
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"
`)
})
})

Xet Storage Details

Size:
1.19 kB
·
Xet hash:
1bec73a5c6b0946c736ba7badd965262e1577f6b7108a6bfd1997d28bc2a06bc

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.