add a test for jsForAPI

This commit is contained in:
Alp Mestanogullari 2015-04-19 11:56:29 +02:00
parent 21b6e96891
commit b09e2bf9da
2 changed files with 5 additions and 1 deletions

View file

@ -74,5 +74,5 @@ test-suite spec
, servant , servant
, hspec >= 2.0 , hspec >= 2.0
, hspec-expectations , hspec-expectations
, language-ecmascript == 0.16.* , language-ecmascript >= 0.16
default-language: Haskell2010 default-language: Haskell2010

View file

@ -90,3 +90,7 @@ generateJSSpec = describe "generateJS" $ do
parseFromString jsText `shouldSatisfy` isRight parseFromString jsText `shouldSatisfy` isRight
jsText `shouldContain` "headerXWhatsForDinner" jsText `shouldContain` "headerXWhatsForDinner"
jsText `shouldContain` "headers: { \"X-WhatsForDinner\": \"I would like \" + headerXWhatsForDinner + \" with a cherry on top.\" }\n" 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