-
Notifications
You must be signed in to change notification settings - Fork 51
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Better event fetching code for e2e tests #1375
base: develop
Are you sure you want to change the base?
Better event fetching code for e2e tests #1375
Conversation
-- | race x y = race y x | ||
-- | race x (race y z) = race (race x y) z | ||
-- | race never x = x | ||
race :: forall (a :: Type). Aff a -> Aff a -> Aff a |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How does this differ from:
race f g = sequential (parallel (try f) <|> parallel (try g)) >>= liftEither
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed. This should be the same. Nice catch.
50e0bbb
to
d6e2e11
Compare
let | ||
-- Asyncronously gets browser events and pushes | ||
-- to the `eventVAar` one by one. | ||
watcher = fix \this -> do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FWIW You don't need to fix under monadic recursion for Aff
, ie you can use watcher
directly and recursively here (and in the other places you have used fix, if you gave them names)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure. That's the matter of taste. I prefer to use fix
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is just less verbose, imho.
foo bar baz quux = something *> foo bar baz quux
foo bar baz quux = fix \this -> something *> this
foo bar baz quux = let this = foo bar baz quux in something *> this
PS.
Well, foo, has a bunch of arguments, and this is not a honest comparison.
watch = something *> watch
watch = fix \this -> something *> this
For me it is just a matter of taste, as I told earlier. :)
Co-authored-by: Joseph Young <[email protected]>
8953a81
to
cf13dc8
Compare
throwError (error nextAfterConfirmAccess) | ||
] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This effectively sets 100 seconds timeout for every test. It's not what we want, the test suite should control the timeouts, not the testing engine.
, delaySec (Seconds 100.0) *> | ||
throwError (error nextAfterSign) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same
, delaySec (Seconds 10.0) *> throwError | ||
(error nextAfterConfirmAccess) | ||
] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same
] | ||
Sign -> handler =<< raceMany | ||
[ waitNextEvent | ||
, delaySec (Seconds 10.0) *> throwError (error nextAfterSign) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same
Pre-review checklist
make format
)Mostly, refactoring of subscribeToBrowserEvents function.