2022-05-22 11:47:58 +00:00
|
|
|
module Test.HTTPurple.StatusSpec where
|
2017-07-17 23:42:13 +00:00
|
|
|
|
2017-07-18 05:31:46 +00:00
|
|
|
import Prelude
|
2022-05-04 21:02:29 +00:00
|
|
|
|
2021-11-19 06:16:35 +00:00
|
|
|
import Effect.Class (liftEffect)
|
2022-05-22 11:47:58 +00:00
|
|
|
import HTTPurple.Status (write)
|
|
|
|
import Test.HTTPurple.TestHelpers (Test, getResponseStatus, mockResponse, (?=))
|
2022-05-04 21:02:29 +00:00
|
|
|
import Test.Spec (describe, it)
|
2017-07-17 23:42:13 +00:00
|
|
|
|
2021-11-19 06:16:35 +00:00
|
|
|
writeSpec :: Test
|
2021-03-22 19:02:36 +00:00
|
|
|
writeSpec =
|
2021-11-19 06:16:35 +00:00
|
|
|
describe "write" do
|
|
|
|
it "writes the given status code" do
|
2021-03-22 19:02:36 +00:00
|
|
|
status <-
|
2021-11-19 06:16:35 +00:00
|
|
|
liftEffect do
|
|
|
|
mock <- mockResponse
|
|
|
|
write mock 123
|
|
|
|
pure $ getResponseStatus mock
|
2021-03-22 19:02:36 +00:00
|
|
|
status ?= 123
|
2017-07-17 23:42:13 +00:00
|
|
|
|
2021-11-19 06:16:35 +00:00
|
|
|
statusSpec :: Test
|
2021-03-22 19:02:36 +00:00
|
|
|
statusSpec =
|
2021-11-19 06:16:35 +00:00
|
|
|
describe "Status" do
|
2021-03-22 19:02:36 +00:00
|
|
|
writeSpec
|