Skip to content

Commit f26df3e

Browse files
author
Timothy Washington
committed
-- updating test for list-entry
1 parent cae3765 commit f26df3e

File tree

1 file changed

+13
-12
lines changed

1 file changed

+13
-12
lines changed

test/bkell/domain/entry_test.clj

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -96,12 +96,6 @@
9696

9797
(ent/entry-balanced? ds group-name entry-transformed))))
9898

99-
;; TODO - test unbalanced
100-
;; TODO - test non-existant accounts
101-
;; TODO - a bigger entry example
102-
;; TODO - test with "find-corresponding-account-byid"
103-
;; TODO - test that entry gets into the correct group
104-
10599
(defspec test-add-entry
106100
10
107101
(prop/for-all [_ gen/int]
@@ -126,7 +120,7 @@
126120
(= '(:db :journal)
127121
(sort (keys (first (ent/add-entry ds group-name entry))))))))
128122

129-
#_(defspec test-list-entry
123+
(defspec test-list-entry
130124
10
131125
(prop/for-all [_ gen/int]
132126

@@ -147,14 +141,21 @@
147141
{:type :debit
148142
:amount 1600
149143
:account "widgets"}]}
144+
_ (ent/add-entry ds group-name entry)
150145

151146
result (ent/list-entries ds group-name)]
152147

153-
(= result
154-
#{{:content #{{:type :credit, :amount 2600.0}
155-
{:type :debit, :amount 1600.0}
156-
{:type :debit, :amount 1000.0}},
157-
:date edate}}))))
148+
149+
150+
(and (= 1 (count result))
151+
152+
(= '(:content :date)
153+
(sort (keys (first result))))
154+
155+
(= (sort-by :type (-> result first :content))
156+
(sort-by :type #{{:type :credit, :amount 2600.0}
157+
{:type :debit, :amount 1600.0}
158+
{:type :debit, :amount 1000.0}}))))))
158159

159160

160161
(comment

0 commit comments

Comments
 (0)