Giter Site home page Giter Site logo

uncino's Issues

TypeScript Support?

Hey there! Is support for TypeScript planned?

PS Saluti da Roma! ๐Ÿ˜

Write better tests for the library

Currently the tests included only check for quite trivial behaviours but don't really guarantee the correctness of the original code in various aspects.

Additional tests are needed to check:

  • The functions passed as hooks are what is actually being called when running the hook. This should involve creating some mock or stub functions and then checking that they have been called with some assertion. As they currently are written most tests would pass even if runHook simply returned the passed argument plus 3 ignoring everything else.
  • That actions actually run. Currently the tests only verify that actions are stored and that runAction resolves but they don't check anything at all about the actions actually being executed. Again, some mocks should be setup and used to verify that they have actually been called.
  • That the "priority" argument works. Currently there's no test at all that verifies in any way the order/priority in which the functions are called. This applies to both hooks and actions.
  • A number of additional edge cases. It would be useful to have tests that check things like calling runHook with no hooks added, or calling removeHook when no hook has been added, or removing/adding hooks from inside a hook function (what is the expected behaviour here? is it documented anywhere?), or some other similar infrequent but not unthinkable cases.

Note that all these things are probably correct in the code now. I'm not saying there are any errors right now, but I'm also not saying that there aren't. What I'm saying is that the included tests are too weak to be useful for anything; they offer very little or no safety at all.

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.