mirror of
https://github.com/Unleash/unleash.git
synced 2024-12-28 00:06:53 +01:00
5872a1c82c
* chore: adapt to vite * remove react-scripts * add jsdom dep, update snaps * fix tests * fix: formatting * fix: vercel rewrite * fix: regeneratorRuntime is not defined Co-authored-by: Tymoteusz Czech <tymek+gpg@getunleash.ai> Co-authored-by: Tymoteusz Czech <2625371+Tymek@users.noreply.github.com>
41 lines
789 B
TypeScript
41 lines
789 B
TypeScript
import { useId } from 'hooks/useId';
|
|
import { renderHook } from '@testing-library/react-hooks';
|
|
|
|
test('useId', () => {
|
|
const { result, rerender } = renderHook(() => useId());
|
|
|
|
rerender();
|
|
rerender();
|
|
|
|
expect(result).toMatchInlineSnapshot(`
|
|
{
|
|
"all": [
|
|
"useId-0",
|
|
"useId-0",
|
|
"useId-0",
|
|
],
|
|
"current": "useId-0",
|
|
"error": undefined,
|
|
}
|
|
`);
|
|
});
|
|
|
|
test('useId prefix', () => {
|
|
const { result, rerender } = renderHook(() => useId('prefix'));
|
|
|
|
rerender();
|
|
rerender();
|
|
|
|
expect(result).toMatchInlineSnapshot(`
|
|
{
|
|
"all": [
|
|
"prefix-1",
|
|
"prefix-1",
|
|
"prefix-1",
|
|
],
|
|
"current": "prefix-1",
|
|
"error": undefined,
|
|
}
|
|
`);
|
|
});
|