Ver código fonte

add marker_test & priority_test

rcmerci 4 anos atrás
pai
commit
850d8d8c7a

+ 26 - 0
src/test/frontend/util/marker_test.cljs

@@ -0,0 +1,26 @@
+(ns frontend.util.marker_test
+  (:require [cljs.test :refer [deftest is are testing]]
+            [frontend.util.marker :as marker]))
+
+(deftest add-or-update-marker-markdown
+  (are [content marker expect] (= expect (marker/add-or-update-marker content :markdown marker))
+    "test content" "TODO" "TODO test content"
+    "\nxxx\n" "TODO" "TODO xxx\n"
+    "## xxx" "TODO" "## TODO xxx"
+    "## [#A] xxx" "TODO" "## TODO [#A] xxx"
+    "" "TODO" "TODO "
+    "todo" "TODO" "TODO todo"
+    "TODO xxx" "DONE" "DONE xxx"
+    "TODO" "DONE" "DONE "
+    "## TODO [#A] xxx" "DONE" "## DONE [#A] xxx"))
+
+(deftest add-or-update-marker-org
+  (are [content marker expect] (= expect (marker/add-or-update-marker content :org marker))
+    "test content" "TODO" "TODO test content"
+    "\nxxx\n" "TODO" "TODO xxx\n"
+    "" "TODO" "TODO "
+    "todo" "TODO" "TODO todo"
+    "TODO xxx" "DONE" "DONE xxx"
+    "TODO" "DONE" "DONE "))
+
+#_(cljs.test/run-tests)

+ 21 - 0
src/test/frontend/util/priority_test.cljs

@@ -0,0 +1,21 @@
+(ns frontend.util.priority_test
+  (:require [cljs.test :refer [deftest is are testing]]
+            [frontend.util.priority :as priority]))
+
+(deftest add-or-update-priority-markdown
+  (are [content priority expect] (= expect (priority/add-or-update-priority content :markdown priority))
+    "test content" "[#A]" "[#A] test content"
+    "" "[#A]" "[#A] "
+    "[#A] xxx" "[#B]" "[#B] xxx"
+    "## xxx" "[#A]" "## [#A] xxx"
+    "## TODO xxx" "[#A]" "## TODO [#A] xxx"
+    "## TODO [#B] xxx" "[#A]" "## TODO [#A] xxx"
+    ))
+
+(deftest add-or-update-marker-org
+  (are [content priority expect] (= expect (priority/add-or-update-priority content :org priority))
+    "test content" "[#A]" "[#A] test content"
+    "" "[#A]" "[#A] "
+    "[#A] xxx" "[#B]" "[#B] xxx"))
+
+#_(cljs.test/run-tests)