Reorder and document import tests
This commit is contained in:
parent
a49880cc94
commit
3e665a4141
1 changed files with 41 additions and 40 deletions
|
@ -8,14 +8,54 @@
|
|||
[clojure.test :as t :refer [deftest is are]]))
|
||||
|
||||
|
||||
;; Run all our functions over two slightly different data examples. 2024 uses
|
||||
;; "Liability" where 2025 uses "Liability Expense".
|
||||
(def paychex-csv-2024 (->> "example-paychex-pay-item-details-2024.csv"
|
||||
clojure.java.io/resource
|
||||
import/read-csv))
|
||||
|
||||
(def paychex-csv-2025 (->> "example-paychex-pay-item-details-2025.csv"
|
||||
clojure.java.io/resource
|
||||
import/read-csv))
|
||||
|
||||
(deftest render-transaction
|
||||
(let [transaction '{:date "DATE"
|
||||
:payee "Paychex"
|
||||
:desc "Monthly Payroll - PERIOD - Fee"
|
||||
:meta
|
||||
{:program "Conservancy:Payroll"
|
||||
:project "Conservancy"
|
||||
:receipt "TODO-FEES-RECEIPT"
|
||||
:invoice "TODO-FEES-INVOICE"
|
||||
:approval
|
||||
"Financial/Employment-Records/memo-re-board-approval-of-payroll.txt"
|
||||
:tax-implication "USA-Corporation"}
|
||||
:postings
|
||||
({:account "Expenses:Payroll:Fees"
|
||||
:amount 103.26M
|
||||
:currency "USD"
|
||||
:meta {:entity "Citizen-Jack"}}
|
||||
{:account "Expenses:Payroll:Fees"
|
||||
:amount 103.25M
|
||||
:currency "USD"
|
||||
:meta {:entity "Citizen-Jill"}}
|
||||
{:account "Assets:Citizens:Check1273" :amount -206.51M :currency "USD"})}
|
||||
actual (import/render-transaction transaction)
|
||||
expected (str/triml "
|
||||
DATE txn \"Paychex\" \"Monthly Payroll - PERIOD - Fee\"
|
||||
program: \"Conservancy:Payroll\"
|
||||
project: \"Conservancy\"
|
||||
receipt: \"TODO-FEES-RECEIPT\"
|
||||
invoice: \"TODO-FEES-INVOICE\"
|
||||
approval: \"Financial/Employment-Records/memo-re-board-approval-of-payroll.txt\"
|
||||
tax-implication: \"USA-Corporation\"
|
||||
Expenses:Payroll:Fees 103.26 USD
|
||||
entity: \"Citizen-Jack\"
|
||||
Expenses:Payroll:Fees 103.25 USD
|
||||
entity: \"Citizen-Jill\"
|
||||
Assets:Citizens:Check1273 -206.51 USD
|
||||
")]
|
||||
(is (= actual expected))))
|
||||
|
||||
(deftest net-pay
|
||||
(let [expected '[{:date "DATE"
|
||||
:desc "Monthly Payroll - PERIOD - Net Pay"
|
||||
|
@ -358,44 +398,5 @@
|
|||
paychex-csv-2024
|
||||
paychex-csv-2025)))
|
||||
|
||||
(deftest render-transaction
|
||||
(let [transaction '{:date "DATE"
|
||||
:payee "Paychex"
|
||||
:desc "Monthly Payroll - PERIOD - Fee"
|
||||
:meta
|
||||
{:program "Conservancy:Payroll"
|
||||
:project "Conservancy"
|
||||
:receipt "TODO-FEES-RECEIPT"
|
||||
:invoice "TODO-FEES-INVOICE"
|
||||
:approval
|
||||
"Financial/Employment-Records/memo-re-board-approval-of-payroll.txt"
|
||||
:tax-implication "USA-Corporation"}
|
||||
:postings
|
||||
({:account "Expenses:Payroll:Fees"
|
||||
:amount 103.26M
|
||||
:currency "USD"
|
||||
:meta {:entity "Citizen-Jack"}}
|
||||
{:account "Expenses:Payroll:Fees"
|
||||
:amount 103.25M
|
||||
:currency "USD"
|
||||
:meta {:entity "Citizen-Jill"}}
|
||||
{:account "Assets:Citizens:Check1273" :amount -206.51M :currency "USD"})}
|
||||
actual (import/render-transaction transaction)
|
||||
expected (str/triml "
|
||||
DATE txn \"Paychex\" \"Monthly Payroll - PERIOD - Fee\"
|
||||
program: \"Conservancy:Payroll\"
|
||||
project: \"Conservancy\"
|
||||
receipt: \"TODO-FEES-RECEIPT\"
|
||||
invoice: \"TODO-FEES-INVOICE\"
|
||||
approval: \"Financial/Employment-Records/memo-re-board-approval-of-payroll.txt\"
|
||||
tax-implication: \"USA-Corporation\"
|
||||
Expenses:Payroll:Fees 103.26 USD
|
||||
entity: \"Citizen-Jack\"
|
||||
Expenses:Payroll:Fees 103.25 USD
|
||||
entity: \"Citizen-Jill\"
|
||||
Assets:Citizens:Check1273 -206.51 USD
|
||||
")]
|
||||
(is (= actual expected))))
|
||||
|
||||
(comment
|
||||
(t/run-all-tests))
|
||||
|
|
Loading…
Add table
Reference in a new issue