diff --git a/packages/trakas-react/__tests__/hooks/useLocalStorage.tsx b/packages/trakas-react/__tests__/hooks/useLocalStorage.tsx new file mode 100644 index 0000000..9c09af9 --- /dev/null +++ b/packages/trakas-react/__tests__/hooks/useLocalStorage.tsx @@ -0,0 +1,101 @@ +import { render, screen } from "@testing-library/react"; +import userEvent from "@testing-library/user-event"; +import { useLocalStorage } from "../../src/hooks/useLocalStorage"; + +type TestComponentProps = { + initialValue?: unknown; + value: unknown; +}; + +function TestComponent(props: TestComponentProps) { + const [storeValue, setValue, clearValue] = useLocalStorage("item", props.initialValue); + + const handleChangeValue = () => { + setValue(props.value); + }; + + return ( + <> + +