From b09e2bf9da8fbb5d51859558ed1aa3dbf477b4dd Mon Sep 17 00:00:00 2001 From: Alp Mestanogullari Date: Sun, 19 Apr 2015 11:56:29 +0200 Subject: [PATCH] add a test for jsForAPI --- servant-jquery.cabal | 2 +- test/Servant/JQuerySpec.hs | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/servant-jquery.cabal b/servant-jquery.cabal index d21d4862..e6acc9ff 100644 --- a/servant-jquery.cabal +++ b/servant-jquery.cabal @@ -74,5 +74,5 @@ test-suite spec , servant , hspec >= 2.0 , hspec-expectations - , language-ecmascript == 0.16.* + , language-ecmascript >= 0.16 default-language: Haskell2010 diff --git a/test/Servant/JQuerySpec.hs b/test/Servant/JQuerySpec.hs index 077b9b87..b8bc5152 100644 --- a/test/Servant/JQuerySpec.hs +++ b/test/Servant/JQuerySpec.hs @@ -90,3 +90,7 @@ generateJSSpec = describe "generateJS" $ do parseFromString jsText `shouldSatisfy` isRight jsText `shouldContain` "headerXWhatsForDinner" jsText `shouldContain` "headers: { \"X-WhatsForDinner\": \"I would like \" + headerXWhatsForDinner + \" with a cherry on top.\" }\n" + + it "can generate the whole javascript code string at once with jsForAPI" $ do + let jsStr = jsForAPI (Proxy :: Proxy TestAPI) + parseFromString jsStr `shouldSatisfy` isRight