flux icon indicating copy to clipboard operation
flux copied to clipboard

Example tests

Open simenbrekken opened this issue 12 years ago • 18 comments

It would be great if the examples included a few (Jest) test cases. Preferably test cases that deal with both components and stores.

simenbrekken avatar Aug 05 '14 09:08 simenbrekken

Yeah, I was thinking about the same :+1:

nobodyguy avatar Aug 07 '14 15:08 nobodyguy

:+1:

justinbelcher avatar Aug 09 '14 05:08 justinbelcher

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.

fisherwebdev avatar Aug 09 '14 17:08 fisherwebdev

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.

justinbelcher avatar Aug 09 '14 17:08 justinbelcher

@fisherwebdev I think it's perfect topic for a blog post and immutable data also sounds great!

nobodyguy avatar Aug 10 '14 15:08 nobodyguy

:+1:

sunnyrjuneja avatar Aug 13 '14 17:08 sunnyrjuneja

:+1: :-)

dmitrig01 avatar Aug 22 '14 20:08 dmitrig01

:+1:

lenage avatar Aug 23 '14 01:08 lenage

:+1:

cirocosta avatar Sep 05 '14 19:09 cirocosta

:+1:

iest avatar Sep 13 '14 18:09 iest

:+1:

naoufal avatar Sep 16 '14 17:09 naoufal

:+1:

marco-loche avatar Sep 17 '14 07:09 marco-loche

:+1:

AlbanMinassian avatar Sep 17 '14 07:09 AlbanMinassian

:+1:

dariocravero avatar Sep 17 '14 10:09 dariocravero

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 avatar Sep 24 '14 22:09 fisherwebdev

@fisherwebdev thanks bill! probably can close this issue tho.

sunnyrjuneja avatar Sep 24 '14 22:09 sunnyrjuneja

@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 avatar Oct 01 '14 00:10 justin808

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

cirocosta avatar Oct 01 '14 02:10 cirocosta