@@ -55,47 +55,4 @@ describe('Sync search strategy', () => {
5555 signal : undefined ,
5656 } ) ;
5757 } ) ;
58-
59- it ( 'increments and decrements loading count on success' , async ( ) => {
60- const expectedLoadingCountValues = [ 0 , 1 , 0 ] ;
61- const receivedLoadingCountValues : number [ ] = [ ] ;
62-
63- mockCoreStart . http . fetch . mockResolvedValueOnce ( 'response' ) ;
64-
65- const syncSearch = syncSearchStrategyProvider ( {
66- core : mockCoreStart ,
67- getSearchStrategy : jest . fn ( ) ,
68- } ) ;
69- const request = { serverStrategy : SYNC_SEARCH_STRATEGY } ;
70-
71- const loadingCount$ = mockCoreStart . http . addLoadingCountSource . mock . calls [ 0 ] [ 0 ] ;
72- loadingCount$ . subscribe ( value => receivedLoadingCountValues . push ( value ) ) ;
73-
74- await syncSearch . search ( request , { } ) . toPromise ( ) ;
75-
76- expect ( receivedLoadingCountValues ) . toEqual ( expectedLoadingCountValues ) ;
77- } ) ;
78-
79- it ( 'increments and decrements loading count on failure' , async ( ) => {
80- expect . assertions ( 1 ) ;
81- const expectedLoadingCountValues = [ 0 , 1 , 0 ] ;
82- const receivedLoadingCountValues : number [ ] = [ ] ;
83-
84- mockCoreStart . http . fetch . mockRejectedValueOnce ( 'error' ) ;
85-
86- const syncSearch = syncSearchStrategyProvider ( {
87- core : mockCoreStart ,
88- getSearchStrategy : jest . fn ( ) ,
89- } ) ;
90- const request = { serverStrategy : SYNC_SEARCH_STRATEGY } ;
91-
92- const loadingCount$ = mockCoreStart . http . addLoadingCountSource . mock . calls [ 0 ] [ 0 ] ;
93- loadingCount$ . subscribe ( value => receivedLoadingCountValues . push ( value ) ) ;
94-
95- try {
96- await syncSearch . search ( request , { } ) . toPromise ( ) ;
97- } catch ( e ) {
98- expect ( receivedLoadingCountValues ) . toEqual ( expectedLoadingCountValues ) ;
99- }
100- } ) ;
10158} ) ;
0 commit comments