Add extra type signatures in servant-js.

This commit is contained in:
Arian van Putten 2015-10-04 23:40:22 +02:00
parent 1e0fa95620
commit 0040badf59

View file

@ -9,7 +9,7 @@
module Servant.JSSpec where module Servant.JSSpec where
import Data.Either (isRight) import Data.Either (isRight)
import Data.Monoid ((<>), mconcat) import Data.Monoid ((<>))
import Data.Proxy import Data.Proxy
import Data.Text (Text) import Data.Text (Text)
import qualified Data.Text as T import qualified Data.Text as T
@ -85,8 +85,10 @@ spec = describe "Servant.JQuery" $ do
axiosSpec axiosSpec
--angularSpec AngularCustom --angularSpec AngularCustom
shouldContain :: Text -> Text -> Expectation
a `shouldContain` b = shouldSatisfy a (T.isInfixOf b) a `shouldContain` b = shouldSatisfy a (T.isInfixOf b)
shouldNotContain :: Text -> Text -> Expectation
a `shouldNotContain` b = shouldNotSatisfy a (T.isInfixOf b) a `shouldNotContain` b = shouldNotSatisfy a (T.isInfixOf b)
axiosSpec :: Spec axiosSpec :: Spec
@ -135,9 +137,9 @@ angularSpec test = describe specLabel $ do
ngOpts = NG.defAngularOptions { NG.serviceName = testName } ngOpts = NG.defAngularOptions { NG.serviceName = testName }
genJS req = NG.angularService ngOpts req genJS req = NG.angularService ngOpts req
parseFromText = parse program ""
generateJSSpec :: TestNames -> (AjaxReq -> Text) -> Spec generateJSSpec :: TestNames -> (AjaxReq -> Text) -> Spec
generateJSSpec n gen = describe specLabel $ do generateJSSpec n gen = describe specLabel $ do
let parseFromText = parse program ""
it "should generate valid javascript" $ do it "should generate valid javascript" $ do
let s = jsForAPI (Proxy :: Proxy TestAPI) (mconcat . map gen) let s = jsForAPI (Proxy :: Proxy TestAPI) (mconcat . map gen)
parseFromText s `shouldSatisfy` isRight parseFromText s `shouldSatisfy` isRight