I have the following code snippet:
(for {
_ <- LiveUserQuery.make(DbManager.failRollback).create(user)
- <- IO.sleep(2.seconds)
a <- router.run(Request(GET, uri"/user/d85ec250-bb5c-11ea-b3de-0242ac130030")).value
} yield a).flatMap {
case Some(req) =>
req.as[User].map { u =>
val is_uuid_valid = u.id.compareTo(UUID.fromString("d85ec250-bb5c-11ea-b3de-0242ac130030")) == 0
expect(is_uuid_valid) && expect(u.gender == "F")
}
case None => expect(false)
}
and would like to avoid the flatMap after the for. How to move the code block from flatMap into for?