Commit 443ea52d authored by MrMan's avatar MrMan

Add test that does migrate

parent 539bc61c
......@@ -201,7 +201,7 @@ data SQLMigration = SQLMigration
-- ^ The ending migration version
, smQuery :: SQLMigrationQuery
-- ^ Query to execute to perform the migration (also responsible)
} deriving (Eq)
} deriving (Eq, Show)
instance Ord SQLMigration where
compare l r = compare (smFrom l) (smFrom r)
......
module Components.TaskStore.SQLiteSpec (spec) where
import Components.TaskStore.SQLite (SQLiteTaskStore)
import Types (Constructable(..), HasMigratableDB(..), TaskStore(..), TaskStoreError)
import Types (Constructable(..), HasMigratableDB(..), TaskStore(..), TaskStoreError, SQLMigrationVersion(..))
import Config (defaultCompleteTaskStoreConfig)
import Data.Either (isRight)
import Control.Monad.IO.Class (liftIO)
import Util (rightOrThrow)
import Test.Hspec
......@@ -19,3 +20,11 @@ spec = do
describe "task store creation" $ do
it "works with the default config" $ \_ -> liftIO makeDefaultStore
>>= (`shouldBe` True) . isRight
describe "task store migration" $ do
it "migrates with the default config (0 -> 1)" $ \_ -> liftIO makeDefaultStore
-- Default stores
>>= rightOrThrow
-- migrate migrates to `desiredVersion`
>>= liftIO . migrate
>>= (`shouldBe` True) . isRight
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment