about summary refs log blame commit diff
path: root/website/sandbox/learnpianochords/src/server/TestUtils.hs
blob: e62950369e65d230ea0c91becb4a98343e7621e9 (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12











                                                                                



                                                                           
--------------------------------------------------------------------------------
module TestUtils where
--------------------------------------------------------------------------------
import Web.JWT
import Data.String.Conversions (cs)
--------------------------------------------------------------------------------

unsafeStringOrURI :: String -> StringOrURI
unsafeStringOrURI x =
  case stringOrURI (cs x) of
    Nothing -> error $ "Failed to convert to StringOrURI: " ++ x
    Just x  -> x

unsafeJust :: Maybe a -> a
unsafeJust Nothing = error "Attempted to force a Nothing to be a something"
unsafeJust (Just x) = x