Git Product home page Git Product logo

Comments (13)

Belco90 avatar Belco90 commented on April 24, 2024 2

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.

Belco90 avatar Belco90 commented on April 24, 2024 2

It took me longer as expected as I was on holidays, but PR for first block of tests ready! #500

from react-use.

Belco90 avatar Belco90 commented on April 24, 2024 2

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.

lvl99 avatar lvl99 commented on April 24, 2024 1

I've been using react-hooks-testing-library which seems pretty good so far.

from react-use.

Belco90 avatar Belco90 commented on April 24, 2024 1

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.

Belco90 avatar Belco90 commented on April 24, 2024 1

@streamich I've edited your description to use it as pending hooks and blocks I need to test.

from react-use.

lvl99 avatar lvl99 commented on April 24, 2024

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.

ZWkang avatar ZWkang commented on April 24, 2024

pick the test tools and make a test branch start it.

from react-use.

ankithkonda avatar ankithkonda commented on April 24, 2024

Please see pull request #221 :) let me know what you guys think

from react-use.

streamich avatar streamich commented on April 24, 2024

@Belco90 that is very very welcome!

from react-use.

streamich avatar streamich commented on April 24, 2024

Does that make sense for you?

@Belco90 Yes, it does.

from react-use.

gerardkabre avatar gerardkabre commented on April 24, 2024

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.

Belco90 avatar Belco90 commented on April 24, 2024

@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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.