Configurability
This commit is contained in:
		@@ -1,4 +1,8 @@
 | 
			
		||||
module Main (main) where
 | 
			
		||||
 | 
			
		||||
import qualified Test.Config
 | 
			
		||||
import Test.Hspec (hspec)
 | 
			
		||||
 | 
			
		||||
main :: IO ()
 | 
			
		||||
main = putStrLn "Test suite not yet implemented."
 | 
			
		||||
main = hspec $ do
 | 
			
		||||
  Test.Config.spec
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										29
									
								
								test/Test/Config.hs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										29
									
								
								test/Test/Config.hs
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,29 @@
 | 
			
		||||
{-# 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
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user