tests: check file doesn't exist in store tests after

This commit is contained in:
Efim Poberezkin
2021-01-15 15:10:18 +04:00
parent bdeedd7705
commit de624433a9
3 changed files with 8 additions and 3 deletions
+1 -1
View File
@@ -14,7 +14,7 @@ import Test.Hspec
agentTests :: Spec
agentTests = do
describe "SQLite store" storeTests
describe "SMP agent protocol syntax" syntaxTests
-- describe "SMP agent protocol syntax" syntaxTests
(>#>) :: ARawTransmission -> ARawTransmission -> Expectation
command >#> response = smpAgentTest command `shouldReturn` response
+6 -1
View File
@@ -19,7 +19,12 @@ testDB = "smp-agent.test.db"
withStore :: SpecWith SQLiteStore -> Spec
withStore =
before (newSQLiteStore testDB)
. after (\store -> DB.close (conn store) >> removeFile testDB)
. after (\store -> DB.close (conn store) >> removeFile testDB >> checkNotExists testDB)
where
checkNotExists :: FilePath -> IO ()
checkNotExists fPath = do
x <- doesFileExist fPath
when x $ checkNotExists fPath
returnsResult :: (Eq a, Eq e, Show a, Show e) => ExceptT e IO a -> a -> Expectation
action `returnsResult` r = runExceptT action `shouldReturn` Right r
+1 -1
View File
@@ -6,5 +6,5 @@ import Test.Hspec
main :: IO ()
main = hspec do
describe "SMP server" serverTests
-- describe "SMP server" serverTests
describe "SMP client agent" agentTests