My function accepts a map argument in which i get the deposit value from it. Currently I'm able to test scenarios like whether the deposit value is empty or whether the deposit value is greater than a certain value etc. My API tracks the number of times a user makes the deposit and keeps track of this using an atom and when user has made more than 4 deposits, he/she should get a certain error message. How can I test this scenario using midje?
Below is my sample test case:
(facts "Mytesting"
(fact "Invalid Amount"
(let [response (httpserver/app (mock/request
:post "/deposit"
{:deposit "9"}))] ;
(:status response) => 422
(:headers response) => {"Content-Type" "application/json; charset=utf-8", "X-Content-Type-Options" "nosniff", "X-Frame-Options" "SAMEORIGIN", "X-XSS-Protection" "1; mode=block"}
(:body response) => (json/write-str {:status-code -2 :status-msg "Invalid Amount"}))))