fix(review): apply autofix feedback
- Alphabetize the import.clj :require block (AGENTS.md Import Formatting). - Remove unused imports (digest, strip) flagged by clj-kondo. - Make the client-not-found classify-table test independent: it previously reused the bank-account-not-found input and added zero marginal coverage; now seeds an orphan bank account so only the client error fires. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -72,11 +72,18 @@
|
||||
(is has-errors?)
|
||||
(is (some (fn [[m _]] (re-find #"bank account" m)) (get-in form-errors [:table 0])))))
|
||||
|
||||
(testing "Unknown client (via bank-account code) is a hard error"
|
||||
(testing "Unknown client fires independently when the bank account exists but is linked to no client"
|
||||
@(dc/transact conn [{:db/id "orphan-ba"
|
||||
:bank-account/code "ORPHAN-CHK"
|
||||
:bank-account/type :bank-account-type/check}])
|
||||
(let [{:keys [form-errors has-errors?]}
|
||||
(sut/classify-table [{:raw-date "01/15/2024" :amount "1.00" :bank-account-code "NOPE"}])]
|
||||
(sut/classify-table [{:raw-date "01/15/2024" :amount "1.00" :bank-account-code "ORPHAN-CHK"}])
|
||||
msgs (map first (get-in form-errors [:table 0]))]
|
||||
(is has-errors?)
|
||||
(is (some (fn [[m _]] (re-find #"client" m)) (get-in form-errors [:table 0])))))
|
||||
(is (some #(re-find #"Cannot find client" %) msgs)
|
||||
"client-not-found error fires")
|
||||
(is (not (some #(re-find #"bank account by code" %) msgs))
|
||||
"bank-account-not-found error does not fire because the bank account exists")))
|
||||
|
||||
(testing "Invalid date is a hard error"
|
||||
(let [{:keys [form-errors has-errors?]}
|
||||
|
||||
Reference in New Issue
Block a user