new Join Room form that requests authcookie
getting stubbed session #1, with auth module stubbed to accept that session in. and stubbed method for streaming room state, but that's enough to start testing room calling api's for other actions next - pass in observable from parent to re-toggle subscription websocket after successful login
This commit is contained in:
@@ -62,7 +62,8 @@ object Auth {
|
||||
roomService.joinRoom(roomId, nickName, nickPassword, roomPassword)
|
||||
)
|
||||
.leftMap(_.toString())
|
||||
newSessionId = Random.nextLong()
|
||||
// newSessionId = Random.nextLong() // TODO return after i stop mocking RoomService
|
||||
newSessionId = TestModels.testSessionId
|
||||
_ <- EitherT.liftF(sessions.update(_.updated(newSessionId, (roomId, playerId))))
|
||||
} yield ResponseCookie(
|
||||
name = authcookieName,
|
||||
|
||||
@@ -24,10 +24,12 @@ object MyHttpService {
|
||||
AuthedRoutes.of {
|
||||
case GET -> Root / "subscribe" as (playerId, roomId) => {
|
||||
val send: Stream[IO, WebSocketFrame] =
|
||||
Stream
|
||||
.emits(TestModels.testChangesList)
|
||||
.covary[IO]
|
||||
.metered(1.second)
|
||||
(
|
||||
Stream
|
||||
.emits(TestModels.testChangesList)
|
||||
.covary[IO]
|
||||
.metered(1.second) ++ Stream.never[IO]
|
||||
)
|
||||
.map(state => WebSocketFrame.Text(state.asJson.noSpaces))
|
||||
|
||||
val receive: Pipe[IO, WebSocketFrame, Unit] = _.evalMap {
|
||||
|
||||
Reference in New Issue
Block a user