diff --git a/test/use-swr-cache.test.tsx b/test/use-swr-cache.test.tsx index b3965eb40..b50851989 100644 --- a/test/use-swr-cache.test.tsx +++ b/test/use-swr-cache.test.tsx @@ -198,19 +198,23 @@ describe('useSWR - cache provider', () => { it('should support fallback values with custom provider', async () => { const key = createKey() function Page() { - const { data } = useSWR(key, async () => { + const { data, isFallback } = useSWR(key, async () => { await sleep(10) return 'data' }) - return <>{String(data)} + return ( + <> + {String(data)},{String(isFallback)} + + ) } renderWithConfig(, { provider: () => provider, fallback: { [key]: 'fallback' } }) - screen.getByText('fallback') // no `undefined`, directly fallback - await screen.findByText('data') + screen.getByText('fallback,true') // no `undefined`, directly fallback + await screen.findByText('data,false') }) it('should not return the fallback if cached', async () => { diff --git a/test/use-swr-loading.test.tsx b/test/use-swr-loading.test.tsx index 8d47bfa98..625195a74 100644 --- a/test/use-swr-loading.test.tsx +++ b/test/use-swr-loading.test.tsx @@ -138,7 +138,7 @@ describe('useSWR - loading', () => { } renderWithConfig() - screen.getByText('data,error,isValidating,mutate') + screen.getByText('data,error,isFallback,isValidating,mutate') }) it('should sync loading states', async () => {