Guest User

Untitled

a guest
Jan 28th, 2019
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.45 KB | None | 0 0
  1. (ns acemotion.test.core.groups.services_test
  2. (:require [acemotion.config :refer [env]]
  3. [acemotion.db.core :refer [*db*] :as db]
  4. [acemotion.test.helpers :as test-helpers]
  5. [acemotion.core.groups.services :as groups-services]
  6. [clojure.test :refer :all]
  7. [luminus-migrations.core :as migrations]
  8. [mount.core :as mount]))
  9.  
  10. (def chris (test-helpers/generate-test-user "chris@user.com"))
  11. (def awa (test-helpers/generate-test-user "awa@user.com"))
  12. (def paul (test-helpers/generate-test-user "paul@user.com"))
  13. (def mo (test-helpers/generate-test-user "mo@user.com"))
  14. (def faii (test-helpers/generate-test-user "faii@user.com"))
  15. (def luck (test-helpers/generate-test-user "luck@user.com"))
  16.  
  17. (defn test-setup [f]
  18. (test-helpers/setup-db!)
  19. (doseq [user [chris awa paul mo faii luck]]
  20. (test-helpers/create-user! user))
  21. (f))
  22.  
  23. (use-fixtures :once test-setup)
  24.  
  25. (comment (test-setup))
  26.  
  27. (deftest groups
  28. (testing "should be able to create group with chris and awa, and both chris and awa should see group"
  29. (groups-services/create-group! (:id chris) [(:id chris) (:id awa)])
  30. (let [groups (groups-services/get-related-groups (:id chris))
  31. [group] groups]
  32. (is (= (count groups) 1))
  33. (is (= (:id chris) (:owner_id group))))
  34. (let [groups (groups-services/get-related-groups (:id awa))
  35. [group] groups]
  36. (is (= (count groups) 1))
  37. (is (= (:id chris) (:owner_id group))))))
Add Comment
Please, Sign In to add comment