packages feed

hegel-0.1.0: test/Hegel/ClientSpec.hs

{-# LANGUAGE OverloadedStrings #-}

module Hegel.ClientSpec (spec) where

import Test.Hspec

import Hegel.Client

spec :: Spec
spec = do
  describe "Default Settings" $ do
    it "provides pure non-CI defaults" $ do
      let stgs = defaultSettings
      settingsTestCases stgs `shouldBe` 100
      settingsVerbosity stgs `shouldBe` Normal
      settingsSeed stgs `shouldBe` Nothing
      settingsDerandomize stgs `shouldBe` False
      settingsDatabase stgs `shouldBe` Unset
      settingsSuppressHealthCheck stgs `shouldBe` []

    it "can be updated through record syntax without exposing the constructor" $ do
      let stgs =
            defaultSettings
              { settingsTestCases = 200
              , settingsDatabase = DatabasePath ".hegel/examples"
              }
      settingsTestCases stgs `shouldBe` 200
      settingsDatabase stgs `shouldBe` DatabasePath ".hegel/examples"

  describe "healthCheckToString" $ do
    it "maps FilterTooMuch correctly" $ do
      healthCheckToString FilterTooMuch `shouldBe` "filter_too_much"

    it "maps TooSlow correctly" $ do
      healthCheckToString TooSlow `shouldBe` "too_slow"

    it "maps TestCasesTooLarge correctly" $ do
      healthCheckToString TestCasesTooLarge `shouldBe` "test_cases_too_large"

    it "maps LargeInitialTestCase correctly" $ do
      healthCheckToString LargeInitialTestCase `shouldBe` "large_initial_test_case"