git.iko.soy/typeable/servant
on master help sign in
Fix broken servant-js tests.
commit0c0c382ae6f7443bfac78b0d009499f9b47102f3 authorMaksymilian Owsianny <Maksymilian.Owsianny@gmail.com> dateWed 2 Dec 2015, 13:22 (11 years ago) parentb6ee20d
2 files changed+9−6
servant-js/src/Servant/JS.hs+1 servant-js/test/Servant/JSSpec.hs+8−6
servant-js/src/Servant/JS.hs+1
@@ -110,6 +110,7 @@ module Servant.JS
110110 , -- * Misc.
111111 listFromAPI
112112 , javascript
113+ , LangJS
113114 , GenerateList(..)
114115 ) where
115116
servant-js/test/Servant/JSSpec.hs+8−6
@@ -98,16 +98,17 @@ a `shouldNotContain` b = shouldNotSatisfy a (T.isInfixOf b)
9898
9999axiosSpec :: Spec
100100axiosSpec = describe specLabel $ do
101+ let reqList = listFromAPI (Proxy :: Proxy LangJS) (Proxy :: Proxy TestAPI)
101102 it "should add withCredentials when needed" $ do
102− let jsText = genJS withCredOpts $ listFromAPI (Proxy :: Proxy TestAPI)
103+ let jsText = genJS withCredOpts $ reqList
103104 output jsText
104105 jsText `shouldContain` "withCredentials: true"
105106 it "should add xsrfCookieName when needed" $ do
106− let jsText = genJS cookieOpts $ listFromAPI (Proxy :: Proxy TestAPI)
107+ let jsText = genJS cookieOpts $ reqList
107108 output jsText
108109 jsText `shouldContain` ("xsrfCookieName: 'MyXSRFcookie'")
109110 it "should add withCredentials when needed" $ do
110− let jsText = genJS headerOpts $ listFromAPI (Proxy :: Proxy TestAPI)
111+ let jsText = genJS headerOpts $ reqList
111112 output jsText
112113 jsText `shouldContain` ("xsrfHeaderName: 'MyXSRFheader'")
113114 where
@@ -121,18 +122,19 @@ axiosSpec = describe specLabel $ do
121122
122123angularSpec :: TestNames -> Spec
123124angularSpec test = describe specLabel $ do
125+ let reqList = listFromAPI (Proxy :: Proxy LangJS) (Proxy :: Proxy TestAPI)
124126 it "should implement a service globally" $ do
125− let jsText = genJS $ listFromAPI (Proxy :: Proxy TestAPI)
127+ let jsText = genJS reqList
126128 output jsText
127129 jsText `shouldContain` (".service('" <> testName <> "'")
128130
129131 it "should depend on $http service globally" $ do
130− let jsText = genJS $ listFromAPI (Proxy :: Proxy TestAPI)
132+ let jsText = genJS reqList
131133 output jsText
132134 jsText `shouldContain` ("('" <> testName <> "', function($http) {")
133135
134136 it "should not depend on $http service in handlers" $ do
135− let jsText = genJS $ listFromAPI (Proxy :: Proxy TestAPI)
137+ let jsText = genJS reqList
136138 output jsText
137139 jsText `shouldNotContain` "getsomething($http, "
138140 where