import React from 'react'; import { describe, it, expect } from 'vitest'; import { Provider } from 'react-redux'; import { store } from '@/state/store'; import { render } from '@testing-library/react'; import { useFetchPosts } from '@/hooks/useFetchPosts'; function Harness({ onReady }: { onReady: (api: ReturnType) => void }) { const api = useFetchPosts(); React.useEffect(() => { onReady(api); // eslint-disable-next-line react-hooks/exhaustive-deps }, []); return null; } describe('useFetchPosts', () => { it('checkAndUpdatePost returns true for new posts', () => { let api!: ReturnType; render( (api = a)} /> , ); const p = { id: '1', user: 'u', title: 't', description: 'd', createdAt: 0 }; expect(api.checkAndUpdatePost(p as any)).toBe(true); }); });