|
@@ -82,4 +82,33 @@
|
|
|
;; 1 (count a-ref-blocks)
|
|
|
;; (set ["b" "c"]) (set alias-names))))
|
|
|
|
|
|
+(deftest ^:focus get-pages-that-mentioned-page-with-show-journal
|
|
|
+ (load-test-files [{:file/path "journals/2020_08_15.md"
|
|
|
+ :file/content "link 1 to [[page ONE]] and link to [[generic page]]"}
|
|
|
+ {:file/path "journals/2020_09_18.md"
|
|
|
+ :file/content "link 2 to [[page ONE]]"}
|
|
|
+ {:file/path "pages/page ONE.md"
|
|
|
+ :file/content "tags:: a tag
|
|
|
+- page one has link to [[Dec 26th, 2020]] journal page"}
|
|
|
+ {:file/path "pages/a tag.md"
|
|
|
+ :file/content "i'm a tag"}
|
|
|
+ {:file/path "pages/generic page.md"
|
|
|
+ :file/content "- link to page one [[page ONE]]"}])
|
|
|
+
|
|
|
+ (is (= '("sep 18th, 2020" "aug 15th, 2020" "generic page")
|
|
|
+ (map first (model/get-pages-that-mentioned-page test-helper/test-db "page ONE" true)))
|
|
|
+ "Must be 'generic page' + 2 journals")
|
|
|
+
|
|
|
+ (is (= '("generic page")
|
|
|
+ (map first (model/get-pages-that-mentioned-page test-helper/test-db "page ONE" false)))
|
|
|
+ "Must be only 'generic page'")
|
|
|
+
|
|
|
+ (is (= '("aug 15th, 2020")
|
|
|
+ (map first (model/get-pages-that-mentioned-page test-helper/test-db "generic page" true)))
|
|
|
+ "Must show only 'aug 15th, 2020'")
|
|
|
+
|
|
|
+ (is (= '()
|
|
|
+ (map first (model/get-pages-that-mentioned-page test-helper/test-db "generic page" false)))
|
|
|
+ "Must be empty"))
|
|
|
+
|
|
|
#_(cljs.test/test-ns 'frontend.db.model-test)
|