UNPKG

wix-style-react

Version:
19 lines 773 B
import { renderHook } from '@testing-library/react-hooks'; import { useId } from './useId'; describe('useId', () => { it('should return a string', () => { const { result } = renderHook(() => useId()); expect(typeof result.current).toBe('string'); }); it('should return unique id', () => { const { result: result1 } = renderHook(() => useId()); const { result: result2 } = renderHook(() => useId()); expect(result1.current).not.toBe(result2.current); }); it('should return an id with the given prefix', () => { const prefix = 'test'; const { result } = renderHook(() => useId(prefix)); expect(result.current.startsWith(prefix)).toBe(true); }); }); //# sourceMappingURL=useId.test.js.map