Fork me on GitHub
#fulcro
<
2018-06-18
>
levitanong07:06:05

@tony.kay what do you think about supporting second-arity versions of transit-str->clj, transit-clj->str and initial-state->script-tag to accept writer/reader opts to allow custom types to be transit encoded?

wilkerlucio14:06:11

@levitanong they already do, you can use the fulcro.transit/writer, the second argument is for customization

levitanong14:06:42

yeah, but there’s no way for the aforementioned functions to pass them to writer.

levitanong14:06:01

which means if i want to pass something to writer, i have to implement those three

wilkerlucio14:06:47

ah, ok, so this is more high level, I never used the fulcro server thing

tony.kay14:06:32

feel free to patch that easy server thing you sent as well 🙂

levitanong14:06:54

awesome, will do that too 😄

tony.kay14:06:59

thanks for the help

wilkerlucio19:06:57

@tony.kay hello, I've find something that contradicts how I though rendering works, when we call the factory method, the return of it is the result of rendering, or something else?

wilkerlucio20:06:29

I'm trying to write generative tests for views, in the hope I can make it trigger some error if it gets unexpected input

wilkerlucio20:06:50

I was expecting the render code to run when I call the factory method, but I'm seeing that is not really like that

wilkerlucio20:06:21

if I call ReactDOM.render, then I see the render code been triggered, but just running the factory doesn't run the render, is that correct or I'm missing something?

tony.kay20:06:54

@levitanong I’ve put that up as 2.5.10-SNAPSHOT on clojars. I have not had the chance to test it as a release, but will release it once I do (or you verify it is working ok)

tony.kay20:06:58

@wilkerlucio it ultimately calls React createElement

tony.kay20:06:06

on the class….React calls render

wilkerlucio20:06:02

yeah, and I guess that doens't trigger a render immediatly

wilkerlucio20:06:34

its fine, and btw, I think those tests work great (assuming you have good specs)

tony.kay20:06:45

which tests?

wilkerlucio20:06:11

generative tests for component rendering, I'm experimenting with tests approaches, and this is one of then

wilkerlucio20:06:48

latest pathom (unreleased yet) as a fn comp-props-generator

wilkerlucio20:06:02

this returns a proper generator given a component (and some settings)

wilkerlucio20:06:21

then I run a prop that calls the factory and mount the component, and then unmount it

wilkerlucio20:06:46

it only tries to detect if any error happens during it (maybe you pass nil to (name) call)

wilkerlucio20:06:07

and it leverages test.check shrunk, if something breaks it gets you the smallest prop configuration for it

tony.kay20:06:14

ah, so kind of data-hardening your components

tony.kay20:06:04

@levitanong Tests didn’t pass…there was an old API incompat in the transit stuff. I fixed it, but would appreciate a live run-through verification.

levitanong02:06:26

That's odd, I ran the tests on my end and they passed. 😮 Thanks, will use on my project and see if there are any problems.

tony.kay14:06:27

Did you run both cljs and clj tests?

levitanong15:06:45

yup! Perhaps I just didn’t see the error being thrown.

tony.kay15:06:13

yeah, it was an arity problem

tony.kay15:06:36

if you start a REPL before refactoring, you cannot trust the tests to catch that

tony.kay15:06:42

you have to restart the REPL

levitanong15:06:08

ahh that would explain it

tony.kay20:06:17

2.5.10-SNAPSHOT updated on clojars