Skip to content

Instantly share code, notes, and snippets.

@chrisza4
Created January 27, 2019 14:49
Show Gist options
  • Select an option

  • Save chrisza4/e8d75c5af4e7e57c910f93c5b9b85acf to your computer and use it in GitHub Desktop.

Select an option

Save chrisza4/e8d75c5af4e7e57c910f93c5b9b85acf to your computer and use it in GitHub Desktop.
(ns acemotion.test.core.groups.services_test
(:require [acemotion.config :refer [env]]
[acemotion.db.core :refer [*db*] :as db]
[acemotion.test.helpers :as test-helpers]
[acemotion.core.groups.services :as groups-services]
[clojure.test :refer :all]
[luminus-migrations.core :as migrations]
[mount.core :as mount]))
(def chris (test-helpers/generate-test-user "chris@user.com"))
(def awa (test-helpers/generate-test-user "awa@user.com"))
(def paul (test-helpers/generate-test-user "paul@user.com"))
(def mo (test-helpers/generate-test-user "mo@user.com"))
(def faii (test-helpers/generate-test-user "faii@user.com"))
(def luck (test-helpers/generate-test-user "luck@user.com"))
(defn test-setup [f]
(test-helpers/setup-db!)
(doseq [user [chris awa paul mo faii luck]]
(test-helpers/create-user! user))
(f))
(use-fixtures :once test-setup)
(comment (test-setup))
(deftest groups
(testing "should be able to create group with chris and awa, and both chris and awa should see group"
(groups-services/create-group! (:id chris) [(:id chris) (:id awa)])
(let [groups (groups-services/get-related-groups (:id chris))
[group] groups]
(is (= (count groups) 1))
(is (= (:id chris) (:owner_id group))))
(let [groups (groups-services/get-related-groups (:id awa))
[group] groups]
(is (= (count groups) 1))
(is (= (:id chris) (:owner_id group))))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment