image-backup/test/Test/Config.hs

30 lines
722 B
Haskell

{-# LANGUAGE OverloadedStrings #-}
module Test.Config where
import Test.Hspec
import Config
import Config.Watcher
import Config.S3
import Dhall (inputFile, auto)
import Control.Monad.IO.Class (MonadIO(..))
spec :: Spec
spec = describe "Reading configuration" $ do
it "Can read the sample configuration" $ do
conf <- liftIO $ inputFile auto "./sample_config.dhall"
let wanted = Config
{ watcher = ConfigWatcher
{ directories = ["/tmp/foo"]
, period = Seconds 300
}
, s3 = ConfigS3
{ region = "fr-par"
, endpoint = "example.com"
, bucket = "example"
}
}
conf `shouldBe` wanted