testing.
This commit is contained in:
@@ -27,14 +27,14 @@
|
||||
(deftest ledger-page
|
||||
(testing "ledger"
|
||||
(testing "it should find ledger entries"
|
||||
(let [result (:ledger-page (:data (sut/query nil "{ ledger_page(client_id: null) { count, start, journal_entries { id } }}")))]
|
||||
(let [result (:ledger-page (:data (sut/query (admin-token) "{ ledger_page(client_id: null) { count, start, journal_entries { id } }}")))]
|
||||
(is (int? (:count result)))
|
||||
(is (int? (:start result)))
|
||||
(is (seqable? (:journal-entries result)))))))
|
||||
|
||||
(deftest transaction-rule-page
|
||||
(testing "it should find rules"
|
||||
(let [result (-> (sut/query nil "{ transaction_rule_page(client_id: null) { count, start, transaction_rules { id } }}")
|
||||
(let [result (-> (sut/query (admin-token) "{ transaction_rule_page(client_id: null) { count, start, transaction_rules { id } }}")
|
||||
:data
|
||||
:transaction-rule-page)]
|
||||
(is (int? (:count result)))
|
||||
@@ -60,7 +60,7 @@
|
||||
:percentage "0.25"
|
||||
:location "B"}]}}
|
||||
[:id ]])}]})]
|
||||
(is (thrown? clojure.lang.ExceptionInfo (sut/query nil q)))))
|
||||
(is (thrown? clojure.lang.ExceptionInfo (sut/query (admin-token) q)))))
|
||||
|
||||
|
||||
(testing "It should reject rules that are missing both description and merchant"
|
||||
@@ -71,7 +71,7 @@
|
||||
:percentage "1.0"
|
||||
:location "B"}]}}
|
||||
[:id ]])}]})]
|
||||
(is (thrown? clojure.lang.ExceptionInfo (sut/query nil q)))))
|
||||
(is (thrown? clojure.lang.ExceptionInfo (sut/query (admin-token) q)))))
|
||||
(testing "it should add rules"
|
||||
(let [q (v/graphql-query {:venia/operation {:operation/type :mutation
|
||||
:operation/name "UpsertTransactionRule"}
|
||||
@@ -91,7 +91,7 @@
|
||||
[:vendor [:name]]
|
||||
[:yodlee-merchant [:name]]
|
||||
[:accounts [:id :percentage [:account [:name]]]]]])}]})
|
||||
result (-> (sut/query nil q)
|
||||
result (-> (sut/query (admin-token) q)
|
||||
:data
|
||||
:upsert-transaction-rule)]
|
||||
|
||||
@@ -114,7 +114,7 @@
|
||||
:percentage "1.0"
|
||||
:location "B"}]}}
|
||||
[[:vendor [:name]]]])}]})
|
||||
result (-> (sut/query nil q)
|
||||
result (-> (sut/query (admin-token) q)
|
||||
:data
|
||||
:upsert-transaction-rule)]
|
||||
|
||||
@@ -132,7 +132,7 @@
|
||||
:percentage "1.0"
|
||||
:location "B"}]}}
|
||||
[[:accounts [:id :percentage [:account [:name]]]]]])}]})
|
||||
result (-> (sut/query nil q)
|
||||
result (-> (sut/query (admin-token) q)
|
||||
:data
|
||||
:upsert-transaction-rule)]
|
||||
|
||||
@@ -147,7 +147,7 @@
|
||||
:yodlee-merchant/yodlee-id "456"}])
|
||||
|
||||
(is (= [{:name "Merchant 1" :yodlee-id "123"} {:name "Merchant 2" :yodlee-id "456"}]
|
||||
(-> (sut/query nil (v/graphql-query {:venia/operation {:operation/type :query
|
||||
(-> (sut/query (admin-token) (v/graphql-query {:venia/operation {:operation/type :query
|
||||
:operation/name "GetYodleeMerchants"}
|
||||
:venia/queries [{:query/data (sut/->graphql [:yodlee-merchants
|
||||
[:yodlee-id :name]])}]}))
|
||||
@@ -179,7 +179,7 @@
|
||||
{:strs [client-1 client-2 bank-account-1 bank-account-2]} (get-in matching-transaction [:tempids])
|
||||
|
||||
rule-test (fn [rule]
|
||||
(-> (sut/query nil (v/graphql-query {:venia/operation {:operation/type :query
|
||||
(-> (sut/query (admin-token) (v/graphql-query {:venia/operation {:operation/type :query
|
||||
:operation/name "TestTransactionRule"}
|
||||
:venia/queries [{:query/data (sut/->graphql [:test-transaction-rule
|
||||
{:transaction-rule rule}
|
||||
|
||||
Reference in New Issue
Block a user