File tree Expand file tree Collapse file tree 1 file changed +5
-8
lines changed
packages/react-router/tests Expand file tree Collapse file tree 1 file changed +5
-8
lines changed Original file line number Diff line number Diff line change @@ -209,19 +209,16 @@ describe('useHistoryState', () => {
209
209
210
210
test ( 'throws when match not found and shouldThrow=true' , async ( ) => {
211
211
function RootComponent ( ) {
212
- try {
213
- useHistoryState ( { from : '/non-existent' , shouldThrow : true } )
214
- return < div > No error</ div >
215
- } catch ( e ) {
216
- return < div > Error occurred: { ( e as Error ) . message } </ div >
217
- }
212
+ useHistoryState ( { from : '/non-existent' , shouldThrow : true } )
213
+ return < div > No error</ div >
218
214
}
219
215
220
216
setup ( { RootComponent } )
221
217
222
- const errorMessage = await screen . findByText ( / E r r o r o c c u r r e d : / )
218
+ const errorMessage = await screen . findByText (
219
+ 'Invariant failed: Could not find an active match from "/non-existent"' ,
220
+ )
223
221
expect ( errorMessage ) . toBeInTheDocument ( )
224
- expect ( errorMessage ) . toHaveTextContent ( / C o u l d n o t f i n d a n a c t i v e m a t c h / )
225
222
} )
226
223
227
224
test ( 'returns undefined when match not found and shouldThrow=false' , async ( ) => {
You can’t perform that action at this time.
0 commit comments