These are chat archives for etorreborre/specs2

19th
Oct 2018
Ben Hutchison
@benhutchison
Oct 19 2018 00:39

Can anyone point me at a complete, self-contained example of how to test Futures on the scalajs platform with Specs 4.2?

Ive been trying awaiton the matcher like so:

actualValueInAFuture must be_===(expectedValue).await

This has triggered the following scalajs error, scala-js/scala-js#1996:

Referring to non-existent method scala.concurrent.impl.Promise$CompletionLatch.acquireSharedInterruptibly(scala.Int)scala.Unit
....
Christopher Davenport
@ChristopherDavenport
Oct 19 2018 00:42
Generally in scalajs, an asynchronous matched since you can't await I believe.
Ben Hutchison
@benhutchison
Oct 19 2018 00:43
sure. Are there any examples of such a thing to follow?
30 mins searching has not found anything yet . the above code is based on the specs2 user guide
There's a bunch of examples in specs2 for scalajs, but none of them use Future
Ben Hutchison
@benhutchison
Oct 19 2018 00:50
I reviewed the 4.0 release notes and blog post, when scalajs support was added, and could find discussion of the probems but no example to work off
Christopher Davenport
@ChristopherDavenport
Oct 19 2018 00:55
Cats-effect is on scariest but tests async stuff for Future. Http4s is on specs2, but doesn't have scalajs. Between those two perhaps something could be pulled together.
Hopefully someone has a better direct example, my apologies.
Ben Hutchison
@benhutchison
Oct 19 2018 01:09
I not confident it works ATM. Specs2 CI tests on JS platform are limited, and don't seem to include any tests of Future (* link corrected )
I'll wait for Eric's input, if something's slipped through Im sure we can close any gaps