Skip to content

Instantly share code, notes, and snippets.

@visibletrap
Created February 25, 2016 03:18
Show Gist options
  • Save visibletrap/7cc9962b6057faca0699 to your computer and use it in GitHub Desktop.
Save visibletrap/7cc9962b6057faca0699 to your computer and use it in GitHub Desktop.
(ns demo-are.core-test
(:require [clojure.test :refer :all]
[demo-are.core :refer [convert]]))
(deftest convert-test1
(let [in {:user-name "tap"
:email1 "[email protected]"
:email2 "[email protected]"
:address {:steet "Rama 1"}
:latitude "123"
:longitude "456"}
out {:username "tap"
:emails ["[email protected]" "[email protected]"]
:address {:street "Rama 1"}
:location {:latitude "123" :longitude "456"}}]
(is (= (convert in) out))))
(deftest convert-test2
(let [in {:user-name "tap"
:email1 "[email protected]"
:email2 "[email protected]"
:address {:steet "Rama 1"}
:latitude "123"
:longitude "456"}
out (convert in)]
(are [x y] (= (get-in in x) (get-in out y))
[:user-name] [:username]
[:email1] [:emails 0]
[:email2] [:emails 1]
[:address :steet] [:address :street]
[:latitude] [:location :latitude]
[:longitude] [:location :longitude])))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment