11import React from 'react' ;
2- import Routes from 'Routes' ;
2+ import { act } from '@testing-library/react' ;
3+ import AppRoutes from 'AppRoutes' ;
34import { renderWithProviders } from 'util/tests' ;
45import { createStore , Store } from 'store' ;
56
@@ -12,7 +13,7 @@ describe('Routes Component', () => {
1213 } ) ;
1314
1415 const render = ( ) => {
15- return renderWithProviders ( < Routes /> , store ) ;
16+ return renderWithProviders ( < AppRoutes /> , store ) ;
1617 } ;
1718
1819 it ( 'should display the Auth page by default' , async ( ) => {
@@ -29,21 +30,27 @@ describe('Routes Component', () => {
2930
3031 it ( 'should display the Loop page' , async ( ) => {
3132 const { findByText, store } = render ( ) ;
32- store . appView . goToLoop ( ) ;
33+ act ( ( ) => {
34+ store . appView . goToLoop ( ) ;
35+ } ) ;
3336 expect ( await findByText ( 'Total Outbound Liquidity' ) ) . toBeInTheDocument ( ) ;
3437 expect ( store . router . location . pathname ) . toBe ( '/loop' ) ;
3538 } ) ;
3639
3740 it ( 'should display the History page' , async ( ) => {
3841 const { findByText, store } = render ( ) ;
39- store . appView . goToHistory ( ) ;
42+ act ( ( ) => {
43+ store . appView . goToHistory ( ) ;
44+ } ) ;
4045 expect ( await findByText ( 'History' ) ) . toBeInTheDocument ( ) ;
4146 expect ( store . router . location . pathname ) . toBe ( '/history' ) ;
4247 } ) ;
4348
4449 it ( 'should display the Settings page' , async ( ) => {
4550 const { findByText, store } = render ( ) ;
46- store . appView . goToSettings ( ) ;
51+ act ( ( ) => {
52+ store . appView . goToSettings ( ) ;
53+ } ) ;
4754 expect ( await findByText ( 'My Node' ) ) . toBeInTheDocument ( ) ;
4855 expect ( store . router . location . pathname ) . toBe ( '/settings' ) ;
4956 } ) ;
0 commit comments