-
Notifications
You must be signed in to change notification settings - Fork 217
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Testing utilities #369
Labels
Comments
relates to #349 |
We're using this to write clojure.test assertions like (defmethod t/assert-expr 'valid
[msg [_ schema data]]
`(let [is-valid?# (m/validate ~schema ~data)]
(t/do-report {:actual ~data
:expected (-> ~schema
(m/explain ~data)
(me/humanize))
:message ~msg
:type (if is-valid?# :pass :fail)}))) Failures look like:
|
Metabase's test runner has something similar: |
Will this evaluate I am using this version now: (defmethod test/assert-expr 'validate
[msg [_ schema actual]]
;; Prevent double-evaluation of `schema` and `actual`:
`(let [schema# ~schema
actual# ~actual]
(test/do-report
{:type (if (m/validate schema# actual#) :pass :fail)
:message ~msg
:expected (me/humanize (m/explain schema# actual#))
:actual actual#}))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
common helpers for malli assertions for tests. Can be done in user space, but, might be handy as a ns like
malli.test
.From Slack:
The text was updated successfully, but these errors were encountered: