on master help sign in
add a test for jsForAPI
b09e2bfAlp Mestanogullari
servant-jquery.cabal+1−1
@@ -74,5 +74,5 @@ test-suite spec
74 , servant
74 , servant
75 , hspec >= 2.0
75 , hspec >= 2.0
76 , hspec-expectations
76 , hspec-expectations
77− , language-ecmascript == 0.16.*
77+ , language-ecmascript >= 0.16
78 default-language: Haskell2010
78 default-language: Haskell2010
test/Servant/JQuerySpec.hs+4
@@ -90,3 +90,7 @@ generateJSSpec = describe "generateJS" $ do
90 parseFromString jsText `shouldSatisfy` isRight
90 parseFromString jsText `shouldSatisfy` isRight
91 jsText `shouldContain` "headerXWhatsForDinner"
91 jsText `shouldContain` "headerXWhatsForDinner"
92 jsText `shouldContain` "headers: { \"X-WhatsForDinner\": \"I would like \" + headerXWhatsForDinner + \" with a cherry on top.\" }\n"
92 jsText `shouldContain` "headers: { \"X-WhatsForDinner\": \"I would like \" + headerXWhatsForDinner + \" with a cherry on top.\" }\n"
93+
94+ it "can generate the whole javascript code string at once with jsForAPI" $ do
95+ let jsStr = jsForAPI (Proxy :: Proxy TestAPI)
96+ parseFromString jsStr `shouldSatisfy` isRight