about summary refs log tree commit diff
path: root/website/sandbox/learnpianochords/src/server/TestUtils.hs
blob: 24054bf47afd4d51eac895930dd58075a9d3ab84 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
--------------------------------------------------------------------------------
module TestUtils where
--------------------------------------------------------------------------------
import RIO
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 res -> res

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