8badd62b3e
- Upgrade all dependencies - Use Effect instead of Eff - Use Foreign.Object instead of StrMap - Use Effect.Ref instead of Control.Monad.ST - Drop SecureServerM, it's the same as ServerM now
33 lines
823 B
Haskell
33 lines
823 B
Haskell
module Test.HTTPure.BodySpec where
|
|
|
|
import Prelude
|
|
|
|
import Effect.Class as EffectClass
|
|
import Test.Spec as Spec
|
|
|
|
import HTTPure.Body as Body
|
|
|
|
import Test.HTTPure.TestHelpers as TestHelpers
|
|
import Test.HTTPure.TestHelpers ((?=))
|
|
|
|
readSpec :: TestHelpers.Test
|
|
readSpec = Spec.describe "read" do
|
|
Spec.it "is the body of the Request" do
|
|
request <- TestHelpers.mockRequest "GET" "" "test" []
|
|
body <- Body.read request
|
|
body ?= "test"
|
|
|
|
writeSpec :: TestHelpers.Test
|
|
writeSpec = Spec.describe "write" do
|
|
Spec.it "writes the string to the Response body" do
|
|
body <- EffectClass.liftEffect do
|
|
resp <- TestHelpers.mockResponse
|
|
Body.write resp "test"
|
|
pure $ TestHelpers.getResponseBody resp
|
|
body ?= "test"
|
|
|
|
bodySpec :: TestHelpers.Test
|
|
bodySpec = Spec.describe "Body" do
|
|
readSpec
|
|
writeSpec
|