mirror of
https://github.com/simplex-chat/simplex-chat.git
synced 2026-03-30 16:25:57 +00:00
* core: communicate call invitations state between NSE and app via db * enable tests * delete calls, encoding * load calls on start * remove line * remove table alias Co-authored-by: JRoberts <8711996+jr-simplex@users.noreply.github.com>
32 lines
902 B
Haskell
32 lines
902 B
Haskell
{-# LANGUAGE OverloadedStrings #-}
|
|
|
|
module SchemaDump where
|
|
|
|
import ChatClient (withTmpFiles)
|
|
import Control.DeepSeq
|
|
import Control.Monad (void)
|
|
import Simplex.Chat.Store (createStore)
|
|
import System.Process (readCreateProcess, shell)
|
|
import Test.Hspec
|
|
|
|
testDB :: FilePath
|
|
testDB = "tests/tmp/test_chat.db"
|
|
|
|
schema :: FilePath
|
|
schema = "src/Simplex/Chat/Migrations/chat_schema.sql"
|
|
|
|
schemaDumpTest :: Spec
|
|
schemaDumpTest =
|
|
it "verify and overwrite schema dump" testVerifySchemaDump
|
|
|
|
testVerifySchemaDump :: IO ()
|
|
testVerifySchemaDump =
|
|
withTmpFiles $ do
|
|
void $ createStore testDB False
|
|
void $ readCreateProcess (shell $ "touch " <> schema) ""
|
|
savedSchema <- readFile schema
|
|
savedSchema `deepseq` pure ()
|
|
void $ readCreateProcess (shell $ "sqlite3 " <> testDB <> " '.schema --indent' > " <> schema) ""
|
|
currentSchema <- readFile schema
|
|
savedSchema `shouldBe` currentSchema
|