   (:require-macros [cemerick.cljs.test :refer [is deftest testing use-fixtures]])
   (:require [lt.plugins.kukui.sync :as sync]
             [lt.plugins.kukui.db :as db]
+            [lt.plugins.kukui.core :as kc]
             [cemerick.cljs.test :as t]))
 
 (defn reset-sync! []


(use-fixtures :each reset-sync!)

(deftest add-on-first-edit
  (let [new-node {:text "drink coffee #type:td #food" :line 0 :indent 0 :type "td" :tags #{"food"}}]
    (sync/sync [new-node] "/some/path")
    (is (seq (db/q '[:find ?e
                     :in $ ?text
                     :where



(deftest add-on-second-edit
  (let [nodes [{:text "drink chocolate #type:td" :line 0}]]
    (sync nodes)
    (sync (conj nodes {:text "drink coffee #type:td" :line 1})))
  (is (= 2
         (count (db/q '[:find ?e
                        :where [?e :text]])))))

(deftest add-with-tag-from-other-node
  (sync [{:text "#name:some? #type:fn" :line 0}
         {:text "such a great name #some? #type:td" :line 1}])
  (is (seq (db/q '[:find ?e
                   :where
                   [?e :tags ?tag]
                   [?tag :name "some?"]]))))

(deftest delete-text-line
  (sync [{:text "drink chocolate #type:td" :line 0}])
  (sync [{:text "drink coffee #type:td" :line 1}])
  (is (= '(1)
         (db/qf '[:find ?line
                  :where [?e :line ?line]]))))

(deftest update-line
  (let [node {:text "drink coffee #type:td" :line 0}
        updated-nodes [{:text "drink chocolate #type:td" :line 0}
                       (assoc node :line 1)]]
    (sync [node])
    (sync updated-nodes)
    (is (= updated-nodes (map
                          #(select-keys % [:text :line])
                          (db/qe '[:find ?e
                                   :where [?e :text]]))))))

