purescript-httpurple/test/HTTPure/IntegrationSpec.purs

40 lines
1.2 KiB
Haskell
Raw Normal View History

module HTTPure.IntegrationSpec where
import Prelude
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-07-10 10:17:13 +00:00
import HTTPure.SpecHelpers as SpecHelpers
import HelloWorld as HelloWorld
import MultiRoute as MultiRoute
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"
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
headersSpec