feat(transactions): port manual bank-transaction import to SSR #8
@@ -19,10 +19,6 @@
|
||||
(def ^:private save-handler
|
||||
#'auto-ap.ssr.transaction.edit/save-handler)
|
||||
|
||||
;; Private simple-mode-fields* accessible via var reference
|
||||
(def ^:private simple-mode-fields*-fn
|
||||
#'auto-ap.ssr.transaction.edit/simple-mode-fields*)
|
||||
|
||||
(use-fixtures :each wrap-setup)
|
||||
|
||||
;;; ---------------------------------------------------------------------------
|
||||
@@ -100,7 +96,6 @@
|
||||
response (edit-vendor-changed-handler request)
|
||||
body (:body response)]
|
||||
;; Response should contain the manual-coding-section div
|
||||
(is (string? body))
|
||||
(is (re-find #"manual-coding-section" body)
|
||||
"Response should contain the manual-coding-section element")
|
||||
;; The vendor's default account ID should appear in the rendered HTML
|
||||
@@ -152,7 +147,6 @@
|
||||
response (edit-vendor-changed-handler request)
|
||||
body (:body response)]
|
||||
;; The handler returns an html-response; verify the body is HTML
|
||||
(is (string? body))
|
||||
(is (re-find #"manual-coding-section" body)
|
||||
"Response body should contain the manual-coding-section element")
|
||||
;; The original account ID must still appear in the rendered HTML
|
||||
@@ -333,7 +327,6 @@
|
||||
:transaction/amount 100.0}}
|
||||
response (edit-wizard-toggle-mode-handler request)
|
||||
body (:body response)]
|
||||
(is (string? body))
|
||||
(is (re-find #"manual-coding-section" body)
|
||||
"Response body should contain the coding section element")
|
||||
;; Advanced mode has Switch to simple mode link (when <=1 row)
|
||||
@@ -377,7 +370,6 @@
|
||||
:transaction/amount 100.0}}
|
||||
response (edit-wizard-toggle-mode-handler request)
|
||||
body (:body response)]
|
||||
(is (string? body))
|
||||
;; Should render in advanced mode
|
||||
(is (re-find #"account-grid-body" body)
|
||||
"Blank simple → advanced should produce account-grid-body")
|
||||
@@ -517,7 +509,6 @@
|
||||
:transaction/amount 100.0}}
|
||||
response (edit-wizard-toggle-mode-handler request)
|
||||
body (:body response)]
|
||||
(is (string? body))
|
||||
;; After toggling from advanced to simple, show "Switch to advanced mode" link
|
||||
(is (re-find #"Switch to advanced mode" body)
|
||||
"After toggling to simple mode, 'Switch to advanced mode' should be visible")
|
||||
@@ -564,7 +555,6 @@
|
||||
:transaction/amount 200.0}}
|
||||
response (edit-vendor-changed-handler request)
|
||||
body (:body response)]
|
||||
(is (string? body))
|
||||
(is (re-find #"manual-coding-section" body))
|
||||
;; Should have account-grid-body (advanced mode)
|
||||
(is (re-find #"account-grid-body" body)
|
||||
@@ -622,7 +612,6 @@
|
||||
:transaction/amount 100.0}}
|
||||
response (edit-vendor-changed-handler request)
|
||||
body (:body response)]
|
||||
(is (string? body))
|
||||
;; The original (existing) account should still be shown
|
||||
(is (re-find (re-pattern (str existing-account-id)) body)
|
||||
"Existing row account should remain unchanged when vendor changes in advanced mode")
|
||||
@@ -826,7 +815,6 @@
|
||||
:transaction/amount 100.0}
|
||||
:identity {:user/role "admin"}}]
|
||||
;; Verify the toggle worked
|
||||
(is (string? (:body toggle-response)))
|
||||
(is (re-find #"account-grid-body" (:body toggle-response))
|
||||
"After toggle, response should be in advanced mode")
|
||||
;; Now save
|
||||
@@ -850,13 +838,6 @@
|
||||
|
||||
(deftest split-transaction-reopens-advanced-test
|
||||
(testing "AC19: split transaction (2+ accounts) re-opens in advanced mode with all splits intact"
|
||||
;; Test manual-mode-initial with 2-row snapshot
|
||||
(is (= :advanced (manual-mode-initial {:db/id 123
|
||||
:transaction/accounts [{:transaction-account/account 1
|
||||
:transaction-account/amount 50.0}
|
||||
{:transaction-account/account 2
|
||||
:transaction-account/amount 50.0}]}))
|
||||
"AC19: 2-account snapshot should return :advanced mode")
|
||||
(let [result @(dc/transact conn [{:db/id "client-id"
|
||||
:client/code "SPLITCL"
|
||||
:client/locations ["DT"]}
|
||||
@@ -912,12 +893,6 @@
|
||||
|
||||
(deftest single-account-reopens-simple-test
|
||||
(testing "AC20: single-account transaction re-opens in simple mode with account/location pre-populated"
|
||||
;; Test manual-mode-initial returns :simple for single-account snapshot
|
||||
(is (= :simple (manual-mode-initial {:db/id 123
|
||||
:transaction/accounts [{:transaction-account/account 456
|
||||
:transaction-account/location "DT"
|
||||
:transaction-account/amount 100.0}]}))
|
||||
"AC20: Single-account snapshot should return :simple mode")
|
||||
(let [result @(dc/transact conn [{:db/id "client-id"
|
||||
:client/code "SINGCL"
|
||||
:client/locations ["DT"]}
|
||||
|
||||
Reference in New Issue
Block a user