Builds client SSR approach, sunsets old cljs.
This commit is contained in:
@@ -162,7 +162,7 @@
|
||||
:type
|
||||
:default_allowance)))))))
|
||||
|
||||
(deftest upsert-account
|
||||
#_(deftest upsert-account
|
||||
(testing "should create a new account"
|
||||
(let [result (sut/upsert-account {:id (admin-token)} {:account {:client_overrides []
|
||||
:numeric_code 123
|
||||
|
||||
@@ -1,91 +0,0 @@
|
||||
(ns auto-ap.integration.graphql.clients
|
||||
(:require
|
||||
[auto-ap.time-reader]
|
||||
[auto-ap.datomic :refer [conn pull-attr]]
|
||||
[auto-ap.graphql.clients :as sut]
|
||||
[auto-ap.integration.util :refer [wrap-setup user-token admin-token]]
|
||||
[datomic.api :as dc]
|
||||
[clojure.test :as t :refer [deftest is testing use-fixtures]]))
|
||||
|
||||
(use-fixtures :each wrap-setup)
|
||||
|
||||
|
||||
(deftest upsert-client
|
||||
(testing "Should create a new client"
|
||||
(let [create-client-request {:code "TEST"
|
||||
:name "Test Co"
|
||||
:matches ["Test Company"]
|
||||
:email "hello@hi.com"
|
||||
:locked_until #clj-time/date-time "2022-01-01"
|
||||
:locations ["DT"]
|
||||
:week_a_debits 1000.0
|
||||
:week_a_credits 2000.0
|
||||
:week_b_debits 3000.0
|
||||
:week_b_credits 9000.0
|
||||
:location_matches [{:location "DT"
|
||||
:match "DOWNTOWN"}]
|
||||
:address {:street1 "hi street"
|
||||
:street2 "downtown"
|
||||
:city "seattle"
|
||||
:state "wa"
|
||||
:zip "1238"}
|
||||
:feature_flags ["new-square"]
|
||||
:bank_accounts [{:code "TEST-1"
|
||||
:bank_name "Bank of America"
|
||||
:bank_code "BANKCODE"
|
||||
:start_date #clj-time/date-time "2022-01-01"
|
||||
:routing "1235"
|
||||
:include_in_reports true
|
||||
|
||||
:name "Bank of Am Check"
|
||||
:visible true
|
||||
:number "1000"
|
||||
:check_number 1001
|
||||
:numeric_code 12001
|
||||
:sort_order 1
|
||||
:locations ["DT"]
|
||||
:use_date_instead_of_post_date? false
|
||||
:type :cash}]
|
||||
|
||||
}
|
||||
create-result (sut/edit-client {:id (admin-token)} {:edit_client create-client-request} nil)]
|
||||
(is (some? (-> create-result :id)))
|
||||
(is (some? (-> create-result :bank_accounts first :id)))
|
||||
(is (= (set (keys create-client-request)) (disj (set (keys create-result))
|
||||
:square_integration_status :yodlee_provider_accounts :plaid_items :id)))
|
||||
|
||||
(testing "Should be able to retrieve created client"
|
||||
(let [created-client (sut/get-admin-client {:id (admin-token)} {:id (:id create-result)} nil)]
|
||||
(is (some? (-> created-client :id)))
|
||||
(is (some? (-> created-client :bank_accounts first :id)))
|
||||
(is (= (set (keys create-client-request)) (disj (set (keys created-client))
|
||||
:square_integration_status :yodlee_provider_accounts :plaid_items :id)))))
|
||||
|
||||
(testing "Should edit an existing client"
|
||||
(let [edit-result (sut/edit-client {:id (admin-token)} {:edit_client {:id (:id create-result)
|
||||
:name "New Company Name"
|
||||
:code "TEST"}} nil)]
|
||||
(is (some? (:id edit-result)))
|
||||
(is (= "New Company Name" (:name edit-result)))))
|
||||
|
||||
(testing "Should support removing collections"
|
||||
(let [edit-result (sut/edit-client {:id (admin-token)} {:edit_client {:id (:id create-result)
|
||||
:matches []
|
||||
:location_matches []
|
||||
:feature_flags []}}
|
||||
nil)]
|
||||
(is (some? (:id edit-result)))
|
||||
(is (seq (:location_matches create-result)))
|
||||
(is (not (seq (:location_matches edit-result))))
|
||||
|
||||
(is (seq (:matches create-result)))
|
||||
(is (not (seq (:matches edit-result))))
|
||||
|
||||
(is (seq (:feature_flags create-result)))
|
||||
(is (not (seq (:feature_flags edit-result))))
|
||||
))
|
||||
))
|
||||
|
||||
(testing "Only admins can create clients"
|
||||
(is (thrown? Exception (sut/edit-client {:id (user-token)} {:edit_client {:code "INVALID"}} nil)))))
|
||||
|
||||
Reference in New Issue
Block a user