percyhanna / chai-react

Chai assertions for React
MIT License
40 stars 3 forks source link

Add assertions for checking component types #3

Closed valscion closed 9 years ago

valscion commented 9 years ago

First of all: Wow, these matchers look very promising! I intend to use them to the greatest extent as possible.

However, I find that some basic assertions are missing and was wondering whether it would be possible to add assertions for checking a type of a component, mainly TestUtils.isComponentOfType().

As many of the test utility methods mentioned in Reacts Test Utilities page seem to be missing, I was wondering whether you have an intention to implement them at some point in the future?

I'm also open for creating PRs for missing functionality as I go along and need them in our project, if that is OK for you. You could also benefit from an improved readme, like the one in chai-jquery, perhaps?

percyhanna commented 9 years ago

Hi Vesa,

It sounds like a good idea to support all the basic matchers that are provided by TestUtils. I am using them internally for some of the other matchers, but there's no reason we couldn't just proxy them as simple assertions.

If you open a PR, I'll gladly review and merge it in.

An improved readme would be great as well, if you're willing to help out there. For now, the tests are the documentation. :)

percyhanna commented 9 years ago

Hi @valscion, you may be interested in checking out another testing library I wrote called rquery. I find it even easier to write tests now by combining rquery and chai-react together. rquery is used to traverse the React tree, and chai-react is used to make assertions.

valscion commented 9 years ago

Wow, seems very promising! I'll keep an eye on rquery and probably start using it in future tests to see how it holds up. Thanks for the tip!