@@ -225,6 +225,64 @@ describe('NetworkErrorBoundary', () => {
225225 } )
226226 } )
227227
228+ describe ( 'when the children component has a 400 error' , ( ) => {
229+ describe ( 'when not running in self-hosted mode' , ( ) => {
230+ it ( 'renders a Bad Request' , async ( ) => {
231+ const { user } = setup ( )
232+ render ( < App status = { 400 } /> , {
233+ wrapper : wrapper ( ) ,
234+ } )
235+
236+ const textBox = await screen . findByRole ( 'textbox' )
237+ await user . type ( textBox , 'fail' )
238+
239+ const badRequest = await screen . findByText ( / B a d R e q u e s t / )
240+ expect ( badRequest ) . toBeInTheDocument ( )
241+ } )
242+
243+ it ( 'renders return to previous page button' , async ( ) => {
244+ const { user } = setup ( )
245+ render ( < App status = { 400 } /> , {
246+ wrapper : wrapper ( ) ,
247+ } )
248+
249+ const textBox = await screen . findByRole ( 'textbox' )
250+ await user . type ( textBox , 'fail' )
251+
252+ const button = await screen . findByText ( 'Return to previous page' )
253+ expect ( button ) . toBeInTheDocument ( )
254+ } )
255+ } )
256+
257+ describe ( 'when running in self hosted mode' , ( ) => {
258+ it ( 'renders a Bad Request' , async ( ) => {
259+ const { user } = setup ( { isSelfHosted : true } )
260+ render ( < App status = { 400 } /> , {
261+ wrapper : wrapper ( ) ,
262+ } )
263+
264+ const textBox = await screen . findByRole ( 'textbox' )
265+ await user . type ( textBox , 'fail' )
266+
267+ const badRequest = await screen . findByText ( / B a d R e q u e s t / )
268+ expect ( badRequest ) . toBeInTheDocument ( )
269+ } )
270+
271+ it ( 'renders return to previous page button' , async ( ) => {
272+ const { user } = setup ( { isSelfHosted : true } )
273+ render ( < App status = { 400 } /> , {
274+ wrapper : wrapper ( ) ,
275+ } )
276+
277+ const textBox = await screen . findByRole ( 'textbox' )
278+ await user . type ( textBox , 'fail' )
279+
280+ const button = await screen . findByText ( 'Return to previous page' )
281+ expect ( button ) . toBeInTheDocument ( )
282+ } )
283+ } )
284+ } )
285+
228286 describe ( 'when the children component has a 404 error' , ( ) => {
229287 describe ( 'when not running in self-hosted mode' , ( ) => {
230288 it ( 'renders a Not found' , async ( ) => {
0 commit comments