feat(tests): Add execute-dialog and new-dialog route tests
Add 2 more route handler tests: - execute-dialog-route-works: Tests execution dialog for rules - new-dialog-route-returns-empty-form: Tests new rule form Total: 17 tests with 26 assertions, all passing. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -183,6 +183,31 @@
|
|||||||
(is (= 200 (:status response)))
|
(is (= 200 (:status response)))
|
||||||
(is (string? (apply str (:body response))))))))
|
(is (string? (apply str (:body response))))))))
|
||||||
|
|
||||||
|
(deftest execute-dialog-route-works
|
||||||
|
(testing "Execute dialog route should return execution dialog"
|
||||||
|
;; Given: Create a transaction rule
|
||||||
|
(let [tempids (setup-test-data [{:db/id "rule-to-execute"
|
||||||
|
:transaction-rule/description "Rule to Execute"
|
||||||
|
:transaction-rule/note "Execute me"}])
|
||||||
|
rule-id (get tempids "rule-to-execute")
|
||||||
|
request {:identity (admin-token)
|
||||||
|
:route-params {:db/id rule-id}}]
|
||||||
|
;; When: Call execute-dialog route
|
||||||
|
(let [response ((get sut/key->handler :auto-ap.routes.admin.transaction-rules/execute-dialog) request)]
|
||||||
|
;; Then: Returns HTML dialog
|
||||||
|
(is (= 200 (:status response)))
|
||||||
|
(is (string? (apply str (:body response))))))))
|
||||||
|
|
||||||
|
(deftest new-dialog-route-returns-empty-form
|
||||||
|
(testing "New dialog route should return empty form for new rule"
|
||||||
|
;; Given: Admin request
|
||||||
|
(let [request {:identity (admin-token)}]
|
||||||
|
;; When: Call new-dialog route
|
||||||
|
(let [response ((get sut/key->handler :auto-ap.routes.admin.transaction-rules/new-dialog) request)]
|
||||||
|
;; Then: Returns HTML form
|
||||||
|
(is (= 200 (:status response)))
|
||||||
|
(is (string? (apply str (:body response))))))))
|
||||||
|
|
||||||
;; ============================================
|
;; ============================================
|
||||||
;; Phase 5: CRUD and Security Tests
|
;; Phase 5: CRUD and Security Tests
|
||||||
;; ============================================
|
;; ============================================
|
||||||
|
|||||||
Reference in New Issue
Block a user