Makes it so that the edit page works better
This commit is contained in:
@@ -67,7 +67,7 @@
|
||||
|
||||
(testing "should set running-balance on ledger entries missing them"
|
||||
|
||||
(sut/refresh-running-balance-cache)
|
||||
(sut/upsert-running-balance)
|
||||
(println (d/pull (d/db conn) '[*] line-1-1))
|
||||
|
||||
(is (= [-10.0 -60.0 -210.0]
|
||||
@@ -82,7 +82,7 @@
|
||||
[{:db/id line-1-1
|
||||
:journal-entry-line/dirty true
|
||||
:journal-entry-line/running-balance 123810.23}])
|
||||
(sut/refresh-running-balance-cache)
|
||||
(sut/upsert-running-balance)
|
||||
|
||||
(is (= [-10.0 -60.0 -210.0]
|
||||
(map #(pull-attr (d/db conn) :journal-entry-line/running-balance %) [line-1-1 line-2-1 line-3-1]))))
|
||||
@@ -93,7 +93,7 @@
|
||||
[{:db/id line-1-1
|
||||
:journal-entry-line/dirty true
|
||||
:journal-entry-line/debit 70.0}])
|
||||
(sut/refresh-running-balance-cache)
|
||||
(sut/upsert-running-balance)
|
||||
(is (= [-70.0 -120.0 -270.0]
|
||||
(map #(pull-attr (d/db conn) :journal-entry-line/running-balance %) [line-1-1 line-2-1 line-3-1]))))
|
||||
(testing "should not recompute entries that aren't dirty"
|
||||
@@ -102,7 +102,7 @@
|
||||
[{:db/id line-1-1
|
||||
:journal-entry-line/dirty false
|
||||
:journal-entry-line/debit 90.0}])
|
||||
(sut/refresh-running-balance-cache)
|
||||
(sut/upsert-running-balance)
|
||||
(is (= [-70.0 -120.0 -270.0]
|
||||
(map #(pull-attr (d/db conn) :journal-entry-line/running-balance %) [line-1-1 line-2-1 line-3-1])))
|
||||
|
||||
|
||||
@@ -84,7 +84,7 @@
|
||||
{:invoice-expense-account/amount -5
|
||||
:invoice-expense-account/location "Shared"}]
|
||||
:invoice/total -101}
|
||||
result (sut8/maybe-spread-locations invoice ["Location 1" ])]
|
||||
result (sut9/maybe-spread-locations invoice ["Location 1" ])]
|
||||
(is (=
|
||||
[{:invoice-expense-account/amount -100.0
|
||||
:invoice-expense-account/location "Location 1"}
|
||||
|
||||
@@ -1,17 +1,20 @@
|
||||
(ns auto-ap.ssr.transaction.edit-test
|
||||
(:require
|
||||
[auto-ap.datomic :refer [conn]]
|
||||
[auto-ap.datomic.accounts :as d-accounts]
|
||||
[auto-ap.datomic.invoices :as d-invoices]
|
||||
[auto-ap.datomic.transactions :as d-transactions]
|
||||
[auto-ap.import.transactions :as i-transactions]
|
||||
[auto-ap.ssr.transaction.edit :refer [get-vendor check-vendor-default-account clientize-vendor
|
||||
transaction-account-row* location-select* account-typeahead*
|
||||
match-payment match-autopay-invoices match-unpaid-invoices apply-rule unlink-payment]]
|
||||
[auto-ap.integration.util :refer [wrap-setup]]
|
||||
[auto-ap.ssr.transaction.edit :refer [account-typeahead* apply-rule
|
||||
check-vendor-default-account
|
||||
clientize-vendor get-vendor
|
||||
location-select*
|
||||
match-autopay-invoices match-payment
|
||||
match-unpaid-invoices
|
||||
transaction-account-row*
|
||||
unlink-payment]]
|
||||
[clojure.test :as t]
|
||||
[datomic.api :as dc]))
|
||||
|
||||
(t/use-fixtures :each (fn [f]
|
||||
#_(t/use-fixtures :each (fn [f]
|
||||
(dc/transact conn [{:db/id "vendor-id"
|
||||
:vendor/name "Test Vendor"
|
||||
:vendor/default-account {:db/id "account-id"}}
|
||||
@@ -20,6 +23,7 @@
|
||||
:client/locations ["Z" "E"]
|
||||
:client/bank-accounts ["bank-account-id"]}])
|
||||
(f)))
|
||||
(t/use-fixtures :each wrap-setup)
|
||||
|
||||
(t/deftest get-vendor-test
|
||||
(t/testing "Should fetch vendor details"
|
||||
@@ -68,7 +72,7 @@
|
||||
(let [typeahead (account-typeahead* {:name "account" :value "account-id" :client-id "client-id"})]
|
||||
(t/is (vector? typeahead))
|
||||
(t/is (= 1 (count (:children typeahead))))
|
||||
(t/is (= "Search..." (:placeholder (:attrs (:children typeahead)))))))
|
||||
(t/is (= "Search..." (:placeholder (:attrs (:children typeahead))))))))
|
||||
|
||||
(t/deftest match-payment-test
|
||||
(t/testing "Should match a payment to a transaction"
|
||||
|
||||
Reference in New Issue
Block a user