{"action":"opened","issue":{"url":"https://api.github.com/repos/eeue56/elm-html-test/issues/61","repository_url":"https://api.github.com/repos/eeue56/elm-html-test","labels_url":"https://api.github.com/repos/eeue56/elm-html-test/issues/61/labels{/name}","comments_url":"https://api.github.com/repos/eeue56/elm-html-test/issues/61/comments","events_url":"https://api.github.com/repos/eeue56/elm-html-test/issues/61/events","html_url":"https://github.com/eeue56/elm-html-test/issues/61","id":306374785,"number":61,"title":"Event.expect does not work well for fuzz tests","user":{"login":"gyzerok","id":1706020,"avatar_url":"https://avatars2.githubusercontent.com/u/1706020?v=4","gravatar_id":"","url":"https://api.github.com/users/gyzerok","html_url":"https://github.com/gyzerok","followers_url":"https://api.github.com/users/gyzerok/followers","following_url":"https://api.github.com/users/gyzerok/following{/other_user}","gists_url":"https://api.github.com/users/gyzerok/gists{/gist_id}","starred_url":"https://api.github.com/users/gyzerok/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gyzerok/subscriptions","organizations_url":"https://api.github.com/users/gyzerok/orgs","repos_url":"https://api.github.com/users/gyzerok/repos","events_url":"https://api.github.com/users/gyzerok/events{/privacy}","received_events_url":"https://api.github.com/users/gyzerok/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-03-19T08:46:34Z","updated_at":"2018-03-19T08:46:34Z","closed_at":null,"author_association":"NONE","body":"Hello!\r\n\r\nI have a number input. The numbers in input can be only within a range, let's say 0-10. The logic within this view function is written so that:\r\n1. if user inputs number less then 0 then it is decoded to 0\r\n2. if user inputs number bigger then 10 it is decoded to 10\r\n3. otherwise it is decoded to number which user inputs\r\n\r\nI want to be able to test this behavior using fuzz tests. With current signature of `Event.expect` such use case gets tricky. My proposal is to change signature to `Event.expect : (msg -> Expectation) -> Event msg -> Expectation`.\r\n\r\nHere is how it would look like in my example:\r\n\r\n```elm\r\ntype Msg\r\n    = Changed\r\n\r\n\r\ntest =\r\n    fuzz Fuzz.int \"number is always within 0 and 10\" <|\r\n        \\n ->\r\n            inputView Changed n\r\n                |> Query.formHtml\r\n                |> Event.simulate (Event.input <| toString n)\r\n                |> Event.expect\r\n                    (\\msg ->\r\n                        case msg of\r\n                            Changed newN ->\r\n                                Expect.all\r\n                                    [ Expect.greaterThan -1\r\n                                    , Expect.lessThan 11\r\n                                    ]\r\n                    )\r\n\r\n```\r\n\r\nThis is a simplified example. In my case component contains several fields and returns complex record, where one of the fields is this input.\r\n\r\nWith the proposed signature current behavior will be still achievable by using `Event.expect (Expect.equal value)`."}}
{"actor":{"display_login":"gyzerok"}}