feat(tests): implement integration and unit tests for auth, company, and ledger behaviors

- Auth: 30 tests (97 assertions) covering OAuth, sessions, JWT, impersonation, roles
- Company: 35 tests (92 assertions) covering profile, 1099, expense reports, permissions
- Ledger: 113 tests (148 assertions) covering grid, journal entries, import, reports
- Fix existing test failures in running_balance, insights, tx, plaid, graphql
- Fix InMemSolrClient to handle Solr query syntax properly
- Update behavior docs: auth (42 done), company (32 done), ledger (120 done)
- All 478 tests pass with 0 failures, 0 errors
This commit is contained in:
2026-05-08 16:12:08 -07:00
parent d9d9263824
commit 6b5d33a32f
64 changed files with 9005 additions and 2086 deletions

View File

@@ -3,16 +3,14 @@
[auto-ap.integration.util :refer [wrap-setup admin-token setup-test-data test-vendor test-account dissoc-id]]
[clojure.test :as t :refer [deftest is testing use-fixtures]]))
(use-fixtures :each wrap-setup)
(deftest vendors
(testing "vendors"
(let [{:strs [test-vendor-id]} (setup-test-data [])]
(testing "it should find vendors"
(let [result (sut2/get-graphql {:id (admin-token)} {} {})]
(is ((into #{} (map :id (:vendors result))) test-vendor-id )))))))
(is ((into #{} (map :id (:vendors result))) test-vendor-id)))))))
(deftest upsert-vendor
(testing "Should allow upsert of an extant vendor"
@@ -38,9 +36,9 @@
:schedule_payment_dom [{:client_id test-client-id
:dom 12}]
:terms_overrides [{:client_id test-client-id
:terms 100}]
:terms 100}]
:account_overrides [{:client_id test-client-id
:account_id test-account-id-2}]
:account_id test-account-id-2}]
:automatically_paid_when_due [test-client-id]}}
nil)]
(is (= {:address {:street1 "1900 Penn ave",
@@ -52,7 +50,7 @@
:search_terms ["New Vendor Name!"],
:terms 30,
:name "New Vendor Name!",
:secondary_contact { :name "Ben"},
:secondary_contact {:name "Ben"},
:usage nil,
:hidden true,
:id test-vendor-id,
@@ -72,7 +70,6 @@
(update :schedule_payment_dom #(map dissoc-id %))
(update :terms_overrides #(map dissoc-id %))
(update :account_overrides #(map dissoc-id %)))))
(is (= 1 (count (:automatically_paid_when_due result))))
))))
(is (= 1 (count (:automatically_paid_when_due result))))))))