Example tests
It would be great if the examples included a few (Jest) test cases. Preferably test cases that deal with both components and stores.
Yeah, I was thinking about the same :+1:
:+1:
Yes, this was something I was thinking about for a code example and blog post. Hoping to get to this idea and also a blog post about immutable data in the coming week or two. On Aug 8, 2014 10:20 PM, "Justin Belcher" [email protected] wrote:
[image: :+1:]
— Reply to this email directly or view it on GitHub https://github.com/facebook/flux/issues/20#issuecomment-51677699.
Probably too specific for a blog post, but one thing I've found tricky/messy is testing Store functions that don't emit change events. And for those that do, making Jest wait until the action has processed to verify behavior.
@fisherwebdev I think it's perfect topic for a blog post and immutable data also sounds great!
:+1:
:+1: :-)
:+1:
:+1:
:+1:
:+1:
:+1:
:+1:
:+1:
Testing Flux Applications http://facebook.github.io/react/blog/2014/09/24/testing-flux-applications.html
Also, example code: https://github.com/facebook/flux/blob/master/examples/flux-todomvc/js/stores/tests/TodoStore-test.js https://github.com/facebook/flux/blob/master/examples/flux-chat/js/stores/tests/UnreadThreadStore-test.js
@fisherwebdev thanks bill! probably can close this issue tho.
@fisherwebdev Did you add docs on how to run the tests, and should they be passing? I just pulled the lastest and get errors running npm test from the example directories. Should I open a new issue for this?
@justin808 this is somewhat related to #68 regarding documenting the build process for the examples. For running the examples test one needs to actually go into the example's folder, install dependencies and then run the tests (e.g,cd examples/flux-chat && npm install && npm test && cd ...). This is needed as the intention was (i suspect) to not agglomerate unrelated dependencies (which is the expected).