You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
hspec-golden-aeson uses arbitrary instances to generate the golden files for the aeson instances. I think the main reason is to ensure the property (encode . decode) x == x. However, I think it can be helpful to use some arbitrary value instead setting one manually. For instance:
-- Module.hstoHTML::User->Html
toHTML User{..} =...-- ModuleSpec.hs
describe "toHTML"$
it "generates a golden file for a User"$let user =User {..}
in defaultGolden "toHTML.User" (renderHTML $ toHTML user)
It would be great to get the user automatically from a random example:
describe "toHTML"$
it "generates a golden file for a User"$
defaultGolden "toHTML.User" (renderHTML . toHTML)
I don't think arbitrary is required for this. faker could be a nice option.
The text was updated successfully, but these errors were encountered:
CristhianMotoche
changed the title
Using arbitrary instances to generate the golden files
Using arbitrary values to generate the golden files
Dec 13, 2019
hspec-golden-aeson uses arbitrary instances to generate the golden files for the aeson instances. I think the main reason is to ensure the property
(encode . decode) x == x
. However, I think it can be helpful to use some arbitrary value instead setting one manually. For instance:It would be great to get the user automatically from a random example:
I don't think arbitrary is required for this. faker could be a nice option.
The text was updated successfully, but these errors were encountered: