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
{{ message }}
This repository was archived by the owner on Apr 20, 2026. It is now read-only.
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.
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.