@@ -9,7 +9,7 @@
9module Servant.JSSpec where
9module Servant.JSSpec where
11import Data.Either (isRight)
11import Data.Either (isRight)
12−import Data.Monoid ((<>), mconcat)
12+import Data.Monoid ((<>))
13import Data.Proxy
13import Data.Proxy
14import Data.Text (Text)
14import Data.Text (Text)
15import qualified Data.Text as T
15import qualified Data.Text as T
@@ -85,8 +85,10 @@ spec = describe "Servant.JQuery" $ do
86 --angularSpec AngularCustom
86 --angularSpec AngularCustom
88−
88+shouldContain :: Text -> Text -> Expectation
89a `shouldContain` b = shouldSatisfy a (T.isInfixOf b)
89a `shouldContain` b = shouldSatisfy a (T.isInfixOf b)
91+shouldNotContain :: Text -> Text -> Expectation
90a `shouldNotContain` b = shouldNotSatisfy a (T.isInfixOf b)
92a `shouldNotContain` b = shouldNotSatisfy a (T.isInfixOf b)
92axiosSpec :: Spec
94axiosSpec :: Spec
@@ -135,9 +137,9 @@ angularSpec test = describe specLabel $ do
135 ngOpts = NG.defAngularOptions { NG.serviceName = testName }
137 ngOpts = NG.defAngularOptions { NG.serviceName = testName }
136 genJS req = NG.angularService ngOpts req
138 genJS req = NG.angularService ngOpts req
138−parseFromText = parse program ""
139generateJSSpec :: TestNames -> (AjaxReq -> Text) -> Spec
140generateJSSpec :: TestNames -> (AjaxReq -> Text) -> Spec
140generateJSSpec n gen = describe specLabel $ do
141generateJSSpec n gen = describe specLabel $ do
142+ let parseFromText = parse program ""
141 it "should generate valid javascript" $ do
143 it "should generate valid javascript" $ do
142 let s = jsForAPI (Proxy :: Proxy TestAPI) (mconcat . map gen)
144 let s = jsForAPI (Proxy :: Proxy TestAPI) (mconcat . map gen)
143 parseFromText s `shouldSatisfy` isRight
145 parseFromText s `shouldSatisfy` isRight