Scalajs-react-experiments/server/test/ApplicationSpec.scala

28 lines
758 B
Scala
Raw Permalink Normal View History

2020-06-06 12:32:17 +00:00
import org.junit.runner._
import org.specs2.runner._
import play.api.test._
/**
* Add your spec here.
* You can mock out a whole application including requests, plugins etc.
* For more information, consult the wiki.
*/
@RunWith(classOf[JUnitRunner])
class ApplicationSpec() extends PlaySpecification {
"Application" should {
"send 404 on a bad request" in new WithApplication {
route(app, FakeRequest(GET, "/boum")) must beSome.which (status(_) == NOT_FOUND)
}
"render the index page" in new WithApplication {
val home = route(app, FakeRequest(GET, "/")).get
status(home) must equalTo(OK)
contentType(home) must beSome.which(_ == "text/html")
contentAsString(home) must contain ("shouts out")
}
}
}