added a bunch of test.s

This commit is contained in:
Bryce Covert
2019-05-11 17:30:26 -07:00
parent 8ecfd4c6ad
commit 067fff8588
2 changed files with 6 additions and 8 deletions

View File

@@ -46,7 +46,7 @@
(testing "it should match rules based on description regex"
(let [matching-transaction @(d/transact (d/connect uri)
[{:transaction/description-original "matching-desc"
:transaction/date #inst "2019-01-05"
:transaction/date #inst "2019-01-05T00:00:00.000-08:00"
:transaction/client {:client/name "1"
:db/id "client-1"}
:transaction/bank-account {:db/id "bank-account-1"
@@ -60,7 +60,7 @@
:db/id "client-2"}
:transaction/bank-account {:db/id "bank-account-2"
:bank-account/name "2"}
:transaction/date #inst "2019-01-15"
:transaction/date #inst "2019-01-15T23:23:00.000-08:00"
:transaction/amount 2.00
:transaction/id "2019-01-15 nonmatching-desc 2"}])
{:strs [client-1 client-2 bank-account-1 bank-account-2]} (get-in matching-transaction [:tempids])
@@ -77,8 +77,8 @@
(is (= [{:id "2019-01-15 nonmatching-desc 2"}] (rule-test {:dom-gte 14 :dom-lte 16})))
(is (= [{:id "2019-01-15 nonmatching-desc 2"}] (rule-test {:dom-gte 14})))
(is (= [{:id "2019-01-05 matching-desc 1"} {:id "2019-01-15 nonmatching-desc 2"}] (rule-test {:dom-lte 15})))
#_(is (= [{:id "2019-01-15 nonmatching-desc 2"}] (rule-test {:dom-gte 15})))
#_(is (= [{:id "2019-01-15 nonmatching-desc 2"}] (rule-test {:dom-gte 15 :dom-lte 15}))))
(is (= [{:id "2019-01-15 nonmatching-desc 2"}] (rule-test {:dom-gte 15})))
(is (= [{:id "2019-01-15 nonmatching-desc 2"}] (rule-test {:dom-gte 15 :dom-lte 15}))))
(testing "based on description"
(is (= [{:id "2019-01-05 matching-desc 1"}] (rule-test {:description "^match"}))))
@@ -94,7 +94,5 @@
(testing "based on bank account"
(is (= [{:id "2019-01-05 matching-desc 1"}] (rule-test {:bank-account-id bank-account-1})))
(is (= [{:id "2019-01-15 nonmatching-desc 2"}] (rule-test {:bank-account-id bank-account-2}))))))
))
(is (= [{:id "2019-01-15 nonmatching-desc 2"}] (rule-test {:bank-account-id bank-account-2}))))))))