@@ -51,9 +51,8 @@ describe('StaleWhileRevalidateWithFallbackStrategy', () => {
5151 } ;
5252 await cacheClient . set ( cacheKey , cacheValue ) ;
5353
54- const result = await staleWhileRevalidateWithFallbackStrategy . handle (
55- context
56- ) ;
54+ const result =
55+ await staleWhileRevalidateWithFallbackStrategy . handle ( context ) ;
5756
5857 expect ( result ) . toEqual ( cacheValue . value ) ;
5958
@@ -80,9 +79,8 @@ describe('StaleWhileRevalidateWithFallbackStrategy', () => {
8079 isCacheable : ( ) => true ,
8180 } satisfies CacheStrategyContext ;
8281
83- const result = await staleWhileRevalidateWithFallbackStrategy . handle (
84- context
85- ) ;
82+ const result =
83+ await staleWhileRevalidateWithFallbackStrategy . handle ( context ) ;
8684
8785 expect ( result ) . toEqual ( methodValue ) ;
8886
@@ -117,9 +115,8 @@ describe('StaleWhileRevalidateWithFallbackStrategy', () => {
117115 } ;
118116 await cacheClient . set ( cacheKey , cacheValue ) ;
119117
120- const result = await staleWhileRevalidateWithFallbackStrategy . handle (
121- context
122- ) ;
118+ const result =
119+ await staleWhileRevalidateWithFallbackStrategy . handle ( context ) ;
123120
124121 expect ( result ) . toEqual ( cacheValue . value ) ;
125122
@@ -179,9 +176,8 @@ describe('StaleWhileRevalidateWithFallbackStrategy', () => {
179176 . spyOn ( cacheClient , 'get' )
180177 . mockRejectedValue ( new Error ( 'cache get error' ) ) ;
181178
182- const result = await staleWhileRevalidateWithFallbackStrategy . handle (
183- context
184- ) ;
179+ const result =
180+ await staleWhileRevalidateWithFallbackStrategy . handle ( context ) ;
185181
186182 expect ( result ) . toEqual ( methodValue ) ;
187183
@@ -216,9 +212,8 @@ describe('StaleWhileRevalidateWithFallbackStrategy', () => {
216212 } ;
217213 await cacheClient . set ( cacheKey , cacheValue ) ;
218214
219- const result = await staleWhileRevalidateWithFallbackStrategy . handle (
220- context
221- ) ;
215+ const result =
216+ await staleWhileRevalidateWithFallbackStrategy . handle ( context ) ;
222217
223218 expect ( result ) . toEqual ( cacheValue . value ) ;
224219
@@ -252,7 +247,11 @@ describe('StaleWhileRevalidateWithFallbackStrategy', () => {
252247 ) . rejects . toThrowError ( 'method error' ) ;
253248
254249 expect ( targetMethod ) . toHaveBeenCalled ( ) ;
255- expect ( onRequestFinished ) . not . toHaveBeenCalled ( ) ;
250+ expect ( onRequestFinished ) . toHaveBeenCalledWith (
251+ expect . any ( Number ) ,
252+ expect . any ( Number ) ,
253+ 'fallbackFailed'
254+ ) ;
256255 expect ( onAsyncCacheWriteFailure ) . not . toHaveBeenCalled ( ) ;
257256 } ) ;
258257} ) ;
0 commit comments