add marker_test & priority_test

This commit is contained in:
rcmerci
2021-05-11 18:32:41 +08:00
committed by Tienson Qin
parent 09b2ea368d
commit 850d8d8c7a
2 changed files with 47 additions and 0 deletions

View File

@@ -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)

View File

@@ -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)