Fork me on GitHub
#re-frame
<
2018-06-22
>
pyr06:06:12

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: https://twitter.com/Exoscale/status/1009804505532325888

eraserhd10:06:35

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)

lwhorton18:06:00

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.

lwhorton18:06:54

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.

eraserhd18:06:04

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.

eraserhd18:06:30

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.

lwhorton18:06:41

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

lwhorton18:06:56

all of which will be much easier than a webdriver test

lwhorton18:06:44

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

adammiller16:06:43

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.

lwhorton16:06:20

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

Hukka06:06:09

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

Desmond07:06:18

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

lwhorton14:06:57

examples of what? generative tests?