Skip to content

Conversation

wedens
Copy link

@wedens wedens commented Jul 4, 2017

It was unused.

Also deleted unused flag parameter.

@pchlupacek
Copy link
Member

@wedens thanks for this. Any chance you can drop in test verifying the behaviour? Thanks

@wedens
Copy link
Author

wedens commented Jul 5, 2017

I'll try to do that. Should I just add tests for controlStream to WebSocketSpec ?

@pchlupacek
Copy link
Member

yes, that would be awesome @wedens.

@wedens
Copy link
Author

wedens commented Jul 17, 2017

Sorry, I don't know how to implement such test :/

My best attempt so far was something ridiculous like:

  property("fail-on-unanswered-pings") = secure {
    val s = Stream.eval(async.unboundedQueue[Task, Unit]).flatMap { pingsQ =>
      Stream.eval(async.unboundedQueue[Task, PingPong]).flatMap { pongsQ =>
        val s = time.awakeEvery[Task](1.second).mapAccumulate(0) {
          case (x, _) if x >= 3 =>
            val s = Stream.eval_(pingsQ.enqueue1(()))
            (x + 1, s)
          case (x, _) =>
            val s = Stream.eval_(pingsQ.enqueue1(())) ++
              Stream.eval_(pongsQ.enqueue1(PingPong.Pong))
            (x + 1, s)
        }.flatMap(_._2)

        val s0 = WebSocket.impl.controlStream(pongsQ.dequeue, pingsQ.dequeue, 3)

        s mergeHaltR s0
      }
    }

    Prop.throws(classOf[Throwable]) {
      s.run.unsafeRun ?= (())
    }
  }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants