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:
@@ -9,7 +9,9 @@
|
|||||||
[auto-ap.graphql.utils :refer [assert-admin]]
|
[auto-ap.graphql.utils :refer [assert-admin]]
|
||||||
[auto-ap.import.manual :as manual]
|
[auto-ap.import.manual :as manual]
|
||||||
[auto-ap.import.transactions :as t]
|
[auto-ap.import.transactions :as t]
|
||||||
|
[auto-ap.permissions :refer [wrap-must]]
|
||||||
[auto-ap.routes.transactions :as route]
|
[auto-ap.routes.transactions :as route]
|
||||||
|
[auto-ap.routes.utils :refer [wrap-client-redirect-unauthenticated]]
|
||||||
[auto-ap.ssr-routes :as ssr-routes]
|
[auto-ap.ssr-routes :as ssr-routes]
|
||||||
[auto-ap.ssr.components :as com]
|
[auto-ap.ssr.components :as com]
|
||||||
[auto-ap.ssr.form-cursor :as fc]
|
[auto-ap.ssr.form-cursor :as fc]
|
||||||
@@ -17,16 +19,13 @@
|
|||||||
[auto-ap.ssr.nested-form-params :refer [wrap-nested-form-params]]
|
[auto-ap.ssr.nested-form-params :refer [wrap-nested-form-params]]
|
||||||
[auto-ap.ssr.ui :refer [base-page]]
|
[auto-ap.ssr.ui :refer [base-page]]
|
||||||
[auto-ap.ssr.utils
|
[auto-ap.ssr.utils
|
||||||
:refer [apply-middleware-to-all-handlers html-response strip
|
:refer [apply-middleware-to-all-handlers html-response
|
||||||
wrap-form-4xx-2 wrap-schema-decode wrap-schema-enforce]]
|
wrap-form-4xx-2 wrap-schema-decode wrap-schema-enforce]]
|
||||||
[auto-ap.permissions :refer [wrap-must]]
|
|
||||||
[auto-ap.routes.utils :refer [wrap-client-redirect-unauthenticated]]
|
|
||||||
[bidi.bidi :as bidi]
|
[bidi.bidi :as bidi]
|
||||||
[clojure.data.csv :as csv]
|
[clojure.data.csv :as csv]
|
||||||
[clojure.java.io :as io]
|
[clojure.java.io :as io]
|
||||||
[clojure.string :as str]
|
[clojure.string :as str]
|
||||||
[datomic.api :as dc]
|
[datomic.api :as dc]
|
||||||
[digest :as di]
|
|
||||||
[malli.core :as mc]
|
[malli.core :as mc]
|
||||||
[slingshot.slingshot :refer [throw+]]))
|
[slingshot.slingshot :refer [throw+]]))
|
||||||
|
|
||||||
|
|||||||
@@ -72,11 +72,18 @@
|
|||||||
(is has-errors?)
|
(is has-errors?)
|
||||||
(is (some (fn [[m _]] (re-find #"bank account" m)) (get-in form-errors [:table 0])))))
|
(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?]}
|
(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 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"
|
(testing "Invalid date is a hard error"
|
||||||
(let [{:keys [form-errors has-errors?]}
|
(let [{:keys [form-errors has-errors?]}
|
||||||
|
|||||||
Reference in New Issue
Block a user