♻️ Refactor internal handling of profile props.

This commit is contained in:
Andrey Antukh 2021-10-05 15:58:45 +02:00 committed by Andrés Moya
parent d36bf188ae
commit 9ecbddc18c
4 changed files with 36 additions and 42 deletions

View file

@ -177,17 +177,6 @@
(t/is (string? token))
;; try register without accepting terms
(let [data {::th/type :register-profile
:token token
:fullname "foobar"
:accept-terms-and-privacy false}
out (th/mutation! data)]
(let [error (:error out)]
(t/is (th/ex-info? error))
(t/is (th/ex-of-type? error :validation))
(t/is (th/ex-of-code? error :invalid-terms-and-privacy))))
;; try register without token
(let [data {::th/type :register-profile
:fullname "foobar"
@ -205,9 +194,7 @@
:accept-terms-and-privacy true
:accept-newsletter-subscription true}]
(let [{:keys [result error]} (th/mutation! data)]
(t/is (nil? error))
(t/is (true? (get-in result [:props :accept-newsletter-subscription])))
(t/is (true? (get-in result [:props :accept-terms-and-privacy])))))
(t/is (nil? error))))
))
(t/deftest prepare-register-with-registration-disabled