Skip to content

Instantly share code, notes, and snippets.

@Gianni-VE
Created April 29, 2024 12:41
Show Gist options
  • Select an option

  • Save Gianni-VE/741486b0440f4b6cc939c1624fa1ff38 to your computer and use it in GitHub Desktop.

Select an option

Save Gianni-VE/741486b0440f4b6cc939c1624fa1ff38 to your computer and use it in GitHub Desktop.
(deftest create-a-game
(let [request {:request-method :post
:uri "/games"
:body {:id 5
:title "Dark Souls"
:releaseDate "2011-09-22"
:develop "FromSoftware"}}
;; Maak een handler die onze create function aanroept met de request content
handler (fn [request] (create (request :body)))
;; Wrap de handler met onze mock servlet
response ((mock-servlet handler) request)]
(is (= 201 (response :status)))
(is (= "/games/5" (get-in response [:headers "Location"])))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment