-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to unit-test a component? Guidance needed #142
Comments
You should check tests for Blaze Components itself. :-) I think they do similar things. You can render it, and then inspect the output. |
Thanks for the amazingly quick response. OK, with the help of I am starting to see the BIG advantages of React-Land, where you would now be able to see and inspect the component within https://github.com/storybooks/react-storybook. DummyQuestion: There is NO way to do something like this in blaze, right? |
You can also do
Maybe you should check: See "template inspector". I think you can write to the author to request components support. :-) There is some console support for debugging. But yes, making a nice UI -- somebody can do it. Everything is there you need. It is easy to get to a component from a DOM element, so then you can inspect its state. |
@mitar: you are the man! This is how the story goes: After playing around for it for 4 hours, I still could not get it to work with my quite-complex template. The first cradle was to get fixtures working on client, which you can get to work using https://atmospherejs.com/hwillson/stub-collections. Still I have a little problem getting simple-schema to work with it - probably because I am using a "transform" approach for collection-helpers (hwillson/meteor-stub-collections#7). The current cradle which i did NOT manage to climb, is debugging blaze-error messages. When running a
Well, what the hell does that mean? I am guessing that it might have to do with some global template-helpers, p.e. using So I am switching back to running unit-tests as chimp-acceptance-tests for now. They are MUCH slower to run, but I need to get some results by this afternoon. Anyways. I'd actually pay for a tutorial on how to unit-test complex templates using Blaze-Components. 👍 |
It would be really great if you could provide some small reproduction. A repository, where you put together what you are trying to do. A simple test case, mocking everything you use and so on. |
Hi guys,
@mitar: Do you think you can give some best-practise guidance on how to test a BlazeCompoent? I love the idea of writing unit-tests for templates as indicated in https://guide.meteor.com/testing.html#simple-blaze-unit-test.
How would you do this with BlazeComponents?
The text was updated successfully, but these errors were encountered: