@@ -761,21 +761,33 @@ describe('Next.js Turbo Redis Cache Integration', () => {
761761 '/pages/revalidated-fetch/revalidate15--default-page' ,
762762 ) ;
763763 expect ( keys1 . length ) . toBe ( 0 ) ;
764- const keys2 = await redisClient . keys (
765- process . env . VERCEL_URL +
766- 'e978cf5ddb8bf799209e828635cfe9ae6862f6735cea97f01ab752ff6fa489b4' ,
767- ) ;
768- expect ( keys2 . length ) . toBe ( 0 ) ;
764+
769765 const hashmap1 = await redisClient . hGet (
770766 process . env . VERCEL_URL + '__sharedTags__' ,
771767 '/pages/revalidated-fetch/revalidate15--default-page' ,
772768 ) ;
773769 expect ( hashmap1 ) . toBeNull ( ) ;
770+
771+ // sub-fetch-request is not removed directly but will be removed on next get request
772+ const keys2 = await redisClient . keys (
773+ process . env . VERCEL_URL +
774+ 'e978cf5ddb8bf799209e828635cfe9ae6862f6735cea97f01ab752ff6fa489b4' ,
775+ ) ;
776+ expect ( keys2 . length ) . toBe ( 1 ) ;
774777 const hashmap2 = await redisClient . hGet (
775778 process . env . VERCEL_URL + '__sharedTags__' ,
776779 'e978cf5ddb8bf799209e828635cfe9ae6862f6735cea97f01ab752ff6fa489b4' ,
777780 ) ;
778- expect ( hashmap2 ) . toBeNull ( ) ;
781+ expect ( hashmap2 ) . toBeDefined ( ) ;
782+
783+ // the page should also be in revalidatedTagsMap so that the nested fetch requests knows that the page was invalidated
784+ const revalidationTimestamp = await redisClient . hGet (
785+ process . env . VERCEL_URL + '__revalidated_tags__' ,
786+ '/pages/revalidated-fetch/revalidate15--default-page' ,
787+ ) ;
788+ console . log ( 'revalidationTimestamp' , revalidationTimestamp ) ;
789+ expect ( revalidationTimestamp ) . toBeDefined ( ) ;
790+ expect ( Number ( revalidationTimestamp ) ) . toBeLessThan ( Number ( Date . now ( ) ) ) ;
779791
780792 // API route should still be cached
781793 const keys3 = await redisClient . keys (
0 commit comments