File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -29,7 +29,6 @@ const SplashScreenActionsContext = React.createContext<SplashScreenActionsContex
2929
3030function loadPostSplashScreenModules ( ) {
3131 import ( './libs/actions/replaceOptimisticReportWithActualReport' ) ;
32- import ( './libs/registerPaginationConfig' ) ;
3332 loadUnreadIndicatorUpdater ( ) ;
3433}
3534
Original file line number Diff line number Diff line change @@ -85,6 +85,8 @@ export default function () {
8585 ] ,
8686 } ) ;
8787
88+ import ( '@libs/registerPaginationConfig' ) ;
89+
8890 // Must be imported after Onyx.init() and outside the React lifecycle so that push notification
8991 // handlers are registered before any push arrives, including Android headless/background wake-ups.
9092 import ( '@libs/Notification/PushNotification/subscribeToPushNotifications' ) ;
Original file line number Diff line number Diff line change 1+ import appSetup from '@src/setup' ;
2+
3+ import Onyx from 'react-native-onyx' ;
4+
5+ const mockRegisterReportActionsPagination = jest . fn ( ) ;
6+
7+ jest . mock ( '@libs/registerPaginationConfig' , ( ) => {
8+ mockRegisterReportActionsPagination ( ) ;
9+ } ) ;
10+ jest . mock ( '@libs/IntlPolyfill' , ( ) => jest . fn ( ) ) ;
11+ jest . mock ( '@userActions/Device' , ( ) => ( { setDeviceID : jest . fn ( ) } ) ) ;
12+ jest . mock ( '@userActions/OnyxDerived' , ( ) => jest . fn ( ) ) ;
13+ jest . mock ( '@src/setup/addUtilsToWindow' , ( ) => jest . fn ( ) ) ;
14+ jest . mock ( '@src/setup/platformSetup' , ( ) => jest . fn ( ) ) ;
15+ jest . mock ( '@src/setup/telemetry' , ( ) => jest . fn ( ) ) ;
16+
17+ describe ( 'app setup' , ( ) => {
18+ it ( 'starts report action pagination registration after initializing Onyx' , async ( ) => {
19+ const onyxInitSpy = jest . spyOn ( Onyx , 'init' ) ;
20+
21+ appSetup ( ) ;
22+ await Promise . resolve ( ) ;
23+
24+ expect ( mockRegisterReportActionsPagination ) . toHaveBeenCalledTimes ( 1 ) ;
25+ const [ onyxInitOrder ] = onyxInitSpy . mock . invocationCallOrder ;
26+ const [ paginationRegistrationOrder ] = mockRegisterReportActionsPagination . mock . invocationCallOrder ;
27+ expect ( onyxInitOrder ) . toBeLessThan ( paginationRegistrationOrder ) ;
28+ } ) ;
29+ } ) ;
You can’t perform that action at this time.
0 commit comments