2017-05-25 19:12:29 +00:00
|
|
|
module HTTPure.IntegrationSpec where
|
|
|
|
|
2017-07-10 10:17:13 +00:00
|
|
|
import Prelude (discard, bind)
|
2017-05-25 19:12:29 +00:00
|
|
|
|
2017-07-10 10:17:13 +00:00
|
|
|
import Control.Monad.Eff.Class as EffClass
|
|
|
|
import Test.Spec as Spec
|
|
|
|
import Test.Spec.Assertions as Assertions
|
2017-05-25 19:12:29 +00:00
|
|
|
|
2017-07-10 10:17:13 +00:00
|
|
|
import HTTPure.SpecHelpers as SpecHelpers
|
|
|
|
|
|
|
|
import HelloWorld as HelloWorld
|
|
|
|
import MultiRoute as MultiRoute
|
2017-07-17 23:42:13 +00:00
|
|
|
import Headers as Headers
|
2017-07-10 10:17:13 +00:00
|
|
|
|
|
|
|
helloWorldSpec :: SpecHelpers.Test
|
|
|
|
helloWorldSpec = Spec.it "runs the hello world example" do
|
|
|
|
EffClass.liftEff HelloWorld.main
|
|
|
|
response <- SpecHelpers.get "http://localhost:8080"
|
|
|
|
response `Assertions.shouldEqual` "hello world!"
|
|
|
|
|
|
|
|
multiRouteSpec :: SpecHelpers.Test
|
|
|
|
multiRouteSpec = Spec.it "runs the multi route example" do
|
|
|
|
EffClass.liftEff MultiRoute.main
|
|
|
|
hello <- SpecHelpers.get "http://localhost:8081/hello"
|
|
|
|
hello `Assertions.shouldEqual` "hello"
|
|
|
|
goodbye <- SpecHelpers.get "http://localhost:8081/goodbye"
|
|
|
|
goodbye `Assertions.shouldEqual` "goodbye"
|
|
|
|
|
2017-07-17 23:42:13 +00:00
|
|
|
headersSpec :: SpecHelpers.Test
|
|
|
|
headersSpec = Spec.it "runs the headers example" do
|
|
|
|
EffClass.liftEff Headers.main
|
|
|
|
header <- SpecHelpers.getHeader "http://localhost:8082" "X-Example"
|
|
|
|
header `Assertions.shouldEqual` "hello world!"
|
|
|
|
|
2017-07-10 10:17:13 +00:00
|
|
|
integrationSpec :: SpecHelpers.Test
|
|
|
|
integrationSpec = Spec.describe "Integration" do
|
|
|
|
helloWorldSpec
|
|
|
|
multiRouteSpec
|
2017-07-17 23:42:13 +00:00
|
|
|
headersSpec
|