diff options
Diffstat (limited to 'test/common.ml')
| -rw-r--r-- | test/common.ml | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/test/common.ml b/test/common.ml new file mode 100644 index 0000000..807289a --- /dev/null +++ b/test/common.ml @@ -0,0 +1,13 @@ +(** Common fuctions shared between the tests *) + +let ( let* ) = Lwt.bind + +(** Connect to the database in memory and create a schema matching the given + configuration *) +let connect : Configuration.Ast.setting -> Caqti_lwt.connection Lwt.t = + fun conf -> + let* conn = Caqti_lwt_unix.connect (Uri.of_string "sqlite3::memory:") in + let* db = Caqti_lwt.or_fail conn in + let module Db = (val db) in + let* () = Query.create db conf in + Lwt.return db |
