purescript-httpurple/Test/HTTPure/HeadersSpec.purs
Connor Prussin 44df22e331 #22 add support for writing headers and status (#32)
* Add support for writing status code

* Add support for writing headers

* Code cleanup
2017-07-17 16:42:13 -07:00

26 lines
731 B
Haskell

module HTTPure.HeadersSpec where
import Prelude (bind, discard, pure, ($))
import Control.Monad.Eff.Class as EffClass
import Data.StrMap as StrMap
import Test.Spec as Spec
import Test.Spec.Assertions as Assertions
import HTTPure.Headers as Headers
import HTTPure.SpecHelpers as SpecHelpers
writeSpec :: SpecHelpers.Test
writeSpec = Spec.describe "write" do
Spec.it "writes the headers to the response" do
header <- EffClass.liftEff do
mock <- SpecHelpers.mockResponse
Headers.write mock $ StrMap.singleton "X-Test" "test"
pure $ SpecHelpers.getResponseHeader "X-Test" mock
header `Assertions.shouldEqual` "test"
headersSpec :: SpecHelpers.Test
headersSpec = Spec.describe "Headers" do
writeSpec