From bf080ced3c51713cf116bf5974f8d6c9af192a2a Mon Sep 17 00:00:00 2001 From: Nick Alexander Date: Wed, 13 Jul 2016 16:17:07 -0700 Subject: [PATCH] Part 2: Add ISQLiteConnectionFactory and CLJC test that uses it. --- src/datomish/jdbc_sqlite.clj | 9 ++++++ src/datomish/promise_sqlite.cljs | 9 ++++++ src/datomish/sqlite.cljc | 5 +++ test/datomish/sqlite_user_version_test.cljc | 35 +++++++++++++++++++++ test/datomish/test.cljs | 2 ++ 5 files changed, 60 insertions(+) create mode 100644 test/datomish/sqlite_user_version_test.cljc diff --git a/src/datomish/jdbc_sqlite.clj b/src/datomish/jdbc_sqlite.clj index 421707d5..a3f5a5b9 100644 --- a/src/datomish/jdbc_sqlite.clj +++ b/src/datomish/jdbc_sqlite.clj @@ -38,3 +38,12 @@ (j/get-connection spec) (assoc spec :connection) (->JDBCSQLiteConnection))))) + +(extend-protocol s/ISQLiteConnectionFactory + String + ( (.open sqlite.DB path (clj->js {:mode mode})) (.then ->SQLite3Connection)))) + +(extend-protocol s/ISQLiteConnectionFactory + string + (!]]]) + #?@(:cljs [[datomish.pair-chan] + [datomish.test-macros :refer-macros [deftest-async]] + [datomish.node-tempfile :refer [tempfile]] + [cljs.test :as t :refer-macros [is are deftest testing async]] + [cljs.core.async :as a :refer [!]]]))) + +(deftest-async test-all-rows + (with-tempfile [t (tempfile)] + (let [db (