critical feature - you can now unset fields.
This commit is contained in:
@@ -52,6 +52,8 @@
|
||||
:location "B"}]}}
|
||||
[:id ]])}]})]
|
||||
(is (thrown? clojure.lang.ExceptionInfo (sut/query nil q)))))
|
||||
|
||||
|
||||
(testing "It should reject rules that are missing both description and merchant"
|
||||
(let [q (v/graphql-query {:venia/operation {:operation/type :mutation
|
||||
:operation/name "UpsertTransactionRule"}
|
||||
@@ -90,6 +92,25 @@
|
||||
(is (= :approved (:transaction-approval-status result)))
|
||||
(is (= "hello" (-> result :accounts (get 0) :account :name )))
|
||||
(is (:id result))
|
||||
|
||||
(testing "it should unset removed fields"
|
||||
(let [q (v/graphql-query {:venia/operation {:operation/type :mutation
|
||||
:operation/name "UpsertTransactionRule"}
|
||||
:venia/queries [{:query/data (sut/->graphql [:upsert-transaction-rule
|
||||
{:transaction-rule {:id (:id result)
|
||||
:description "123"
|
||||
:vendor-id nil
|
||||
:accounts [{:id (-> result :accounts (get 0) :id)
|
||||
:account-id account-id
|
||||
:percentage "1.0"
|
||||
:location "B"}]}}
|
||||
[[:vendor [:name]]]])}]})
|
||||
result (-> (sut/query nil q)
|
||||
:data
|
||||
:upsert-transaction-rule)]
|
||||
|
||||
(is (nil? (:vendor result)))))
|
||||
|
||||
(testing "it should delete removed rules"
|
||||
(let [q (v/graphql-query {:venia/operation {:operation/type :mutation
|
||||
:operation/name "UpsertTransactionRule"}
|
||||
|
||||
Reference in New Issue
Block a user