(conformed-stub env sym arglist result)Creates a stub that validates args/return against guardrails specs. Checks for Malli schema first (via :malli/schema metadata), then Clojure Spec fspec. Falls back to original spec-only behavior if neither is found.
Creates a stub that validates args/return against guardrails specs. Checks for Malli schema first (via :malli/schema metadata), then Clojure Spec fspec. Falls back to original spec-only behavior if neither is found.
(extract-mocked-symbols forms)Extract the function symbols being mocked from mock triple forms. Returns a vector of symbols (not necessarily qualified - they're as written in the mock).
Extract the function symbols being mocked from mock triple forms. Returns a vector of symbols (not necessarily qualified - they're as written in the mock).
(format-mock-error sym error-type error-data)Formats a clear error message for mock validation failures.
Arguments:
Returns a human-readable error message describing what went wrong.
Formats a clear error message for mock validation failures. Arguments: - sym: The symbol of the mocked function - error-type: The type of error (e.g., ::instrument/invalid-spec-input) - error-data: The error details map from the instrument layer Returns a human-readable error message describing what went wrong.
(parse-arrow-count sym)parses how many times the mock/stub should be called with.
parses how many times the mock/stub should be called with. * => implies 1+, * =Ax=> implies exactly A times. Provided arrow counts cannot be zero because mocking should not be a negative assertion, but a positive one. IE: verify that what you want to be called is called instead, or that, if necessary, it should throw an error if called.
(parse-mock-triple env
conform?
{:as triple :keys [under-mock arrow result behavior]})(spec-only-conformed-stub env sym arglist result)Original spec-only stub validation (fallback when no guardrails schema).
Original spec-only stub validation (fallback when no guardrails schema).
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |