Fork me on GitHub

Hi! Just passing by to say we professed our love for re-frame (used for a lot of internal tooling and soon for our main public property) at Exoscale:


What's the best way to test a React app? Better than unit tests, good informational value about the system working, but not necessarily phantomjs (although, if that's the best we've got, I'll take it)


what are you testing? quite frequently i find that people who test react views are just testing that react works properly… which is pointless. on the other hand, if you feel like you need to test the rendering part of your reframe app, that can all be done via data-in/data-out tests (don’t need to include react). also, if you feel the need to test a view, it’s probably too complicated and can be broken into smaller pieces.


if you want webdriver type tests like selenium or phantom that’s an option, but I would carefully scrutinize the amount of value you’re getting from those tests, too.


I have a complicated set of forms driven from a data description. I'm currently testing that the raw form of the data description correctly generates a tree of maps which is much closer to the UI and have made my UI pretty thin. I just found a bug that made it to production (and corrupts data on the back end!) that changed when I wired values to the "value" slot for text fields instead of the "defaultValue" slot.


I actually haven't located the bug yet, but I can repro it. It is either a subtle issue in the UI description (which includes information about which sets of fields get saved when something changes), or it is a bug in the handler which updates my app state.


sounds like if you test descriptor -> nested map and can show that works, you need to test nested map -> reagent views


all of which will be much easier than a webdriver test


start small, build it up, and use spec to generate thousands of test cases automatically. it takes a little bit more time up front, but a fully spec’d test suite is neigh impenetrable once it’s implemented


Also sounds like spec'ing your app state and using an interceptor that validates on every event would prevent invalid state from arriving in your app-db.


that’s what i do… every entity has a full spec and there’s an :after interceptor that does a s/explain


In Javascript and with Reagent we have made a "component guide" that shows example use for every component, and then we run phantomjs or even real browsers against it, sometimes checking for visual regressions


@U0W0JDY4C do you have any publicly visible examples of this with re-frame?


examples of what? generative tests?