Skip to content
This repository has been archived by the owner on Dec 25, 2024. It is now read-only.

Commit

Permalink
Update tests; bump copyright years
Browse files Browse the repository at this point in the history
  • Loading branch information
publicimageltd committed Mar 19, 2021
1 parent dad093b commit d9422b8
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 55 deletions.
2 changes: 1 addition & 1 deletion delve-data-types.el
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
;;; delve-data-types.el --- data types for the delve tool -*- lexical-binding: t; -*-

;; Copyright (C) 2020
;; Copyright (C) 2021

;; Author: <joerg@joergvolbers.de>

Expand Down
4 changes: 3 additions & 1 deletion delve-edit.el
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
;;; delve-edit.el --- functions for remote editing org roam files -*- lexical-binding: t; -*-

;; Copyright (C) 2020
;; Copyright (C) 2020-2021

;; This file is part of Delve.

;; Author: <joerg@joergvolbers.de>

Expand Down
4 changes: 3 additions & 1 deletion delve-minor-mode.el
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
;;; delve-minor-mode.el --- minor mode for optimized integration of delve and org roam -*- lexical-binding: t; -*-

;; Copyright (C) 2020
;; Copyright (C) 2021

;; This file is part of Delve.

;; Author: <joerg@joergvolbers.de>

Expand Down
60 changes: 8 additions & 52 deletions tests/delve-test-db.el
Original file line number Diff line number Diff line change
Expand Up @@ -75,36 +75,6 @@
(expect (delve--flatten nil)
:to-be nil)))

(describe "delve-db-rearrange"
(it "rearranges using position index"
(expect (delve-db-rearrange [1 0] '((a b) (a b)))
:to-equal
'((b a) (b a))))
(it "discards non-indexed values when rearranging"
(expect (delve-db-rearrange [0] '((a b c) (a b c)))
:to-equal
'((a) (a))))
(it "rearranges and applies functions with arity 1"
(expect (delve-db-rearrange [1 (0 1+)] '((1 0) (1 0)))
:to-equal
'((0 2) (0 2))))
(it "rearranges and applies functions with anaphoric argument 'it'"
(expect (delve-db-rearrange [1 (0 (1+ it))] '((1 0) (1 0)))
:to-equal
'((0 2) (0 2))))
(it "adds keyword to the rearranged items:"
(expect (delve-db-rearrange [:count 1] '((0 20) (1 87)))
:to-equal
'((:count 20) (:count 87))))
(it "adds keywords to the rearranged items:"
(expect (delve-db-rearrange [:count 1 :yes 0] '((0 20) (1 87)))
:to-equal
'((:count 20 :yes 0) (:count 87 :yes 1))))
(it "it passes strings as-is when rearranging:"
(expect (delve-db-rearrange [:count 1 :string \"hi\"] '((0 20) (1 87)))
:to-equal
'((:count 20 :string \"hi\") (:count 87 :string \"hi\")))))

(describe "Catching malformed queries"
(before-all
(delve-test-setup-db))
Expand Down Expand Up @@ -149,7 +119,8 @@
:to-equal
'(2 2 1))))

(describe "delve-db-count-backlinks"
;; FIXME Wait until org roam v2
(xdescribe "delve-db-count-backlinks"
(it "counts backlinks for file reference.org"
(expect
(delve-db-count-backlinks (delve-test-get-file "reference.org"))
Expand All @@ -167,7 +138,8 @@
(delve-db-count-backlinks (delve-test-get-file "reference2.org"))
:to-be 1)))

(describe "delve-db-count-tolinks"
;; FIXME Wait until org roam v2
(xdescribe "delve-db-count-tolinks"
(it "counts tolinks for file reference.org"
(expect
(delve-db-count-tolinks (delve-test-get-file "reference.org"))
Expand Down Expand Up @@ -267,8 +239,9 @@
(expect (delve-page-title page)
:to-match
"Reference")))))

(describe "delve-db-query-backlinks"

;; FIXME Wait until org roam v2
(xdescribe "delve-db-query-backlinks"
(describe "backlinks for 'reference.org'"
:var (result file-name)
(before-all
Expand Down Expand Up @@ -303,24 +276,7 @@
(it "returns zettel objects"
(dolist (zettel result)
(expect (delve-zettel-p zettel)
:to-be-truthy)))))

(describe "delve-db-query-sort-by-mtime"
:var (zettel-list)
(before-all
(setq zettel-list
(cl-loop for i from 1 to 5
do (sleep-for 0.1)
collect (delve-make-zettel :title (format "%d" i)
:mtime (current-time)))))

(it "sorts zettel by mtime, last one first"
(expect (mapcar #'delve-zettel-title
(delve-db-query-sort-by-mtime zettel-list))
:to-equal
'("5" "4" "3" "2" "1"))))

(describe "delve-db-query-last-10-modified"))
:to-be-truthy))))))


(provide 'delve-test-db)
Expand Down
6 changes: 6 additions & 0 deletions tests/delve-test-main.el
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,12 @@ itself ommitted."
;; * The Specs

(describe "Expanding"
:var (inhibit-message)
(before-all
;; Eldev can't handle "with-temp-message", so mute it:
(setq inhibit-message t))
(after-all
(setq inhibit-message nil))

(describe "delve-expand"
(it "can be called with no operator"
Expand Down

0 comments on commit d9422b8

Please sign in to comment.