1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-01-06 00:07:44 +01:00
unleash.unleash/frontend/src/hooks/useId.test.ts

29 lines
542 B
TypeScript
Raw Normal View History

import { useId } from 'hooks/useId';
import { renderHook } from '@testing-library/react';
test('useId', () => {
const { result, rerender } = renderHook(() => useId());
rerender();
rerender();
expect(result).toMatchInlineSnapshot(`
{
"current": "useId-0",
}
`);
});
test('useId prefix', () => {
const { result, rerender } = renderHook(() => useId('prefix'));
rerender();
rerender();
expect(result).toMatchInlineSnapshot(`
{
"current": "prefix-1",
}
`);
});