Fix HTTPure.Utils.replacePlus (#166)
* Create failing test. * Fix code so failing test passes.
This commit is contained in:
parent
a81abca2d6
commit
b3eb977096
@ -19,7 +19,7 @@ encodeURIComponent = unsafeEncodeURIComponent
|
|||||||
|
|
||||||
replacePlus :: String -> String
|
replacePlus :: String -> String
|
||||||
replacePlus =
|
replacePlus =
|
||||||
String.replace (String.Pattern "+") (String.Replacement "%20")
|
String.replaceAll (String.Pattern "+") (String.Replacement "%20")
|
||||||
|
|
||||||
|
|
||||||
urlDecode :: String -> String
|
urlDecode :: String -> String
|
||||||
|
19
test/Test/HTTPure/UtilsSpec.purs
Normal file
19
test/Test/HTTPure/UtilsSpec.purs
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
module Test.HTTPure.UtilsSpec where
|
||||||
|
|
||||||
|
import Prelude
|
||||||
|
|
||||||
|
import Data.Tuple as Tuple
|
||||||
|
import Foreign.Object as Object
|
||||||
|
import Test.Spec as Spec
|
||||||
|
|
||||||
|
import HTTPure.Query as Query
|
||||||
|
import HTTPure.Utils as Utils
|
||||||
|
|
||||||
|
import Test.HTTPure.TestHelpers as TestHelpers
|
||||||
|
import Test.HTTPure.TestHelpers ((?=))
|
||||||
|
|
||||||
|
utilsSpec :: TestHelpers.Test
|
||||||
|
utilsSpec = Spec.describe "replacePlus" do
|
||||||
|
Spec.it "should replace all pluses" do
|
||||||
|
Utils.replacePlus "HTTPPure+is+A+purescript+HTTP+server+framework" ?=
|
||||||
|
"HTTPPure%20is%20A%20purescript%20HTTP%20server%20framework"
|
@ -17,6 +17,7 @@ import Test.HTTPure.RequestSpec as RequestSpec
|
|||||||
import Test.HTTPure.ResponseSpec as ResponseSpec
|
import Test.HTTPure.ResponseSpec as ResponseSpec
|
||||||
import Test.HTTPure.ServerSpec as ServerSpec
|
import Test.HTTPure.ServerSpec as ServerSpec
|
||||||
import Test.HTTPure.StatusSpec as StatusSpec
|
import Test.HTTPure.StatusSpec as StatusSpec
|
||||||
|
import Test.HTTPure.UtilsSpec as UtilsSpec
|
||||||
import Test.HTTPure.VersionSpec as VersionSpec
|
import Test.HTTPure.VersionSpec as VersionSpec
|
||||||
import Test.HTTPure.IntegrationSpec as IntegrationSpec
|
import Test.HTTPure.IntegrationSpec as IntegrationSpec
|
||||||
|
|
||||||
@ -34,5 +35,6 @@ main = Aff.launchAff_ $ Runner.runSpec [ Reporter.specReporter ] $ Spec.describe
|
|||||||
ResponseSpec.responseSpec
|
ResponseSpec.responseSpec
|
||||||
ServerSpec.serverSpec
|
ServerSpec.serverSpec
|
||||||
StatusSpec.statusSpec
|
StatusSpec.statusSpec
|
||||||
|
UtilsSpec.utilsSpec
|
||||||
VersionSpec.versionSpec
|
VersionSpec.versionSpec
|
||||||
IntegrationSpec.integrationSpec
|
IntegrationSpec.integrationSpec
|
||||||
|
Loading…
Reference in New Issue
Block a user