Add test for safeLink applied to an EmptyAPI type
This commit is contained in:
parent
249a8386a5
commit
7d07db7ed3
1 changed files with 7 additions and 0 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue