Add test for safeLink applied to an EmptyAPI type

This commit is contained in:
David Turner 2017-05-16 16:25:01 +00:00
parent 249a8386a5
commit 7d07db7ed3

View file

@ -25,6 +25,7 @@ type TestApi =
:<|> "post" :> ReqBody '[JSON] 'True :> Post '[JSON] NoContent
:<|> "delete" :> Header "ponies" String :> Delete '[JSON] NoContent
:<|> "raw" :> Raw
:<|> NoEndpoint
apiLink :: (IsElem endpoint TestApi, HasLink endpoint)
@ -98,6 +99,11 @@ spec = describe "Servant.Utils.Links" $ do
-- ...Could not deduce...
-- ...
--
-- >>> apiLink (Proxy :: Proxy NoEndpoint)
-- ...
-- ...No instance for...
-- ...
--
-- sanity check
-- >>> toUrlPiece $ apiLink (Proxy :: Proxy AllGood)
-- "get"
@ -107,3 +113,4 @@ type WrongContentType = "get" :> Get '[OctetStream] NoContent
type WrongMethod = "get" :> Post '[JSON] NoContent
type NotALink = "hello" :> ReqBody '[JSON] 'True :> Get '[JSON] Bool
type AllGood = "get" :> Get '[JSON] NoContent
type NoEndpoint = "empty" :> EmptyAPI