Comments (13)
Can I help with this? I love this collection of hooks and I like adding tests so I'm more than happy to help with this.
I've written tests for hooks before just with react-testing-library by creating a fake component within the test itself, but react-hooks-testing-library is another good option (which basically do the same: wrap the hook into a fake component and return the results).
I've seen some tests already added by @ankithkonda so the set up and the structure is already defined, I can add more tests following same pattern.
from react-use.
It took me longer as expected as I was on holidays, but PR for first block of tests ready! #500
from react-use.
Second block of tests ready! #554
From now on I'll keep adding tests by blocks but I'll create a PR for each hook test, so 1) I avoid re-doing tests done by someone else while I create my PR, 2) I have my branches up to date and I don't have to keep it updated with master, and 3) I can merge bug fixes asap if I found any issue while testing.
from react-use.
I've been using react-hooks-testing-library
which seems pretty good so far.
from react-use.
Ok so my idea is to add tests for all hooks section by section on storybook (animation, lifecycle, state, etc) and create a PR for each of those sections. Does that make sense for you? I'll start from animation section since it already has some tests and are simple to be tested.
from react-use.
@streamich I've edited your description to use it as pending hooks and blocks I need to test.
from react-use.
When I was testing some async hooks I wasn't able to adequately get around the act()
error messages from generating. I know with CI=true
on create-react-app
that these messages can prevent a build pipeline from succeeding, even if the tests themselves passed.
from react-use.
pick the test tools and make a test branch start it.
from react-use.
Please see pull request #221 :) let me know what you guys think
from react-use.
@Belco90 that is very very welcome!
from react-use.
Does that make sense for you?
@Belco90 Yes, it does.
from react-use.
I don't know if you plan to keep the conversation about tests in this issue but just in case, just created a PR adding tests for useWindowScroll: #1183 following the same style @ankithkonda used for useWindowSize.
from react-use.
@gerardkabre Sorry but I can't continue adding tests here since I've been really busy lately. However, I think I added a nice bunch of tests here to get a solid base to keep testing other hooks.
from react-use.
Related Issues (20)
- Request: replace keyboardjs dependency with keystrokes (updated lib) HOT 1
- `useLocalStorage` not working with updater function HOT 1
- useVideo.story.tsx - sampleVideo can not be loaded HOT 3
- How to make clicking some elements an exception for useClickAway hook
- Add a reset history method to useStateWithHistory
- Install hooks seperate from each other HOT 2
- UseKeyPressEvent doesn't work when non-english language is set HOT 1
- useMeasure dimensions out of sync in react18 HOT 2
- Please add a list of valid keys to https://github.com/streamich/react-use/blob/master/docs/useKey.md
- useMedia deprecated methods HOT 1
- There is deprecated dependency in your nano-css HOT 1
- useWindowSize does not work on App Router (nextjs) HOT 1
- useCopyToClipboard: accept options object to pass to copy-to-clipboard HOT 2
- useCopyToClipboard: accept options object to pass to copy-to-clipboard
- [question]: How can I combine useMeasure with useHoverDirty HOT 1
- useLocalStorage doesn't not remove key on setValue(undefined) HOT 1
- useLocalStorage documentation: warn against calling with same key in multiple components HOT 1
- useLocalStorage without 'or undefined' HOT 2
- Breaking rules of hooks leads to incorrect behaviour in useLocalStorage
- useMedia throw "addEventListener is not a function" error occurs in browsers ios13.1 and below
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-use.