import { render } from '@testing-library/react'; import '@testing-library/jest-dom'; import { useStrf } from './useStrf'; const TEMPLATE = 'Testing {name} hook'; const OBJECT = { name: 'useStrf' }; const FINAL_VALUE = 'Testing useStrf hook'; const TestComponent = (): JSX.Element => { const strf = useStrf(); const value = strf(TEMPLATE, OBJECT); return
{value}
; }; describe('useStrf Hook', () => { it('text be formatted', () => { const { queryByText } = render(); expect(queryByText(FINAL_VALUE)).toBeInTheDocument(); }); });