git.iko.soy/typeable/servant
on master help sign in
Add test for safeLink applied to an EmptyAPI type
commit7d07db7ed30df90bc9c4de4e332e80204345fee3 authorDavid Turner <dave.c.turner@gmail.com> dateTue 16 May 2017, 16:25 (9 years ago) parent249a838
1 file changed+7
servant/test/Servant/Utils/LinksSpec.hs+7
servant/test/Servant/Utils/LinksSpec.hs+7
@@ -25,6 +25,7 @@ type TestApi =
2525 :<|> "post" :> ReqBody '[JSON] 'True :> Post '[JSON] NoContent
2626 :<|> "delete" :> Header "ponies" String :> Delete '[JSON] NoContent
2727 :<|> "raw" :> Raw
28+ :<|> NoEndpoint
2829
2930
3031apiLink :: (IsElem endpoint TestApi, HasLink endpoint)
@@ -98,6 +99,11 @@ spec = describe "Servant.Utils.Links" $ do
9899-- ...Could not deduce...
99100-- ...
100101--
102+-- >>> apiLink (Proxy :: Proxy NoEndpoint)
103+-- ...
104+-- ...No instance for...
105+-- ...
106+--
101107-- sanity check
102108-- >>> toUrlPiece $ apiLink (Proxy :: Proxy AllGood)
103109-- "get"
@@ -107,3 +113,4 @@ type WrongContentType = "get" :> Get '[OctetStream] NoContent
107113type WrongMethod = "get" :> Post '[JSON] NoContent
108114type NotALink = "hello" :> ReqBody '[JSON] 'True :> Get '[JSON] Bool
109115type AllGood = "get" :> Get '[JSON] NoContent
116+type NoEndpoint = "empty" :> EmptyAPI