File tree Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -99,14 +99,16 @@ describe('createCachingMethods', () => {
9999 } )
100100
101101 it ( `deletes from cache` , async ( ) => {
102- await api . findOneById ( docs . id1 . _id , { ttl : 1 } )
102+ for ( const doc of [ docs . id1 , docs . id2 ] ) {
103+ await api . findOneById ( doc . _id , { ttl : 1 } )
103104
104- const valueBefore = await cache . get ( cacheKey ( docs . id1 . _id ) )
105- expect ( valueBefore ) . toEqual ( EJSON . stringify ( docs . id1 ) )
105+ const valueBefore = await cache . get ( cacheKey ( doc . _id ) )
106+ expect ( valueBefore ) . toEqual ( EJSON . stringify ( doc ) )
106107
107- await api . deleteFromCacheById ( docs . id1 . _id )
108+ await api . deleteFromCacheById ( doc . _id )
108109
109- const valueAfter = await cache . get ( cacheKey ( docs . id1 . _id ) )
110- expect ( valueAfter ) . toBeUndefined ( )
110+ const valueAfter = await cache . get ( cacheKey ( doc . _id ) )
111+ expect ( valueAfter ) . toBeUndefined ( )
112+ }
111113 } )
112114} )
You can’t perform that action at this time.
0 commit comments