File tree Expand file tree Collapse file tree 2 files changed +15
-1
lines changed
Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -52,4 +52,18 @@ describe('pullToRefresh()', () => {
5252 await user . pullToRefresh ( screen . getByTestId ( 'view' ) ) ;
5353 expect ( onRefreshMock ) . toHaveBeenCalled ( ) ;
5454 } ) ;
55+
56+ it ( 'does not throw when RefreshControl is not set' , async ( ) => {
57+ render ( < ScrollView testID = "view" /> ) ;
58+ const user = userEvent . setup ( ) ;
59+
60+ await expect ( ( ) => user . pullToRefresh ( screen . getByTestId ( 'view' ) ) ) . not . toThrow ( ) ;
61+ } ) ;
62+
63+ it ( 'does not throw when RefreshControl onRefresh is not set' , async ( ) => {
64+ render ( < ScrollView testID = "view" refreshControl = { < RefreshControl refreshing = { false } /> } /> ) ;
65+ const user = userEvent . setup ( ) ;
66+
67+ await expect ( ( ) => user . pullToRefresh ( screen . getByTestId ( 'view' ) ) ) . not . toThrow ( ) ;
68+ } ) ;
5569} ) ;
Original file line number Diff line number Diff line change @@ -8,10 +8,10 @@ import type { PressOptions } from '../press';
88import { longPress , press } from '../press' ;
99import type { ScrollToOptions } from '../scroll' ;
1010import { scrollTo } from '../scroll' ;
11+ import { pullToRefresh } from '../scroll/pull-to-refresh' ;
1112import type { TypeOptions } from '../type' ;
1213import { type } from '../type' ;
1314import { wait } from '../utils' ;
14- import { pullToRefresh } from '../scroll/pull-to-refresh' ;
1515
1616export interface UserEventSetupOptions {
1717 /**
You can’t perform that action at this time.
0 commit comments