Makes it so that the edit page works better

This commit is contained in:
2025-03-05 14:25:43 -08:00
parent f881bdcc93
commit 59d48342ea
6 changed files with 118 additions and 76 deletions

View File

@@ -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"}

View File

@@ -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"