diff options
author | Gabriel A. Giovanini <mail@gabrielgio.me> | 2018-03-08 23:23:21 -0300 |
---|---|---|
committer | Gabriel A. Giovanini <mail@gabrielgio.me> | 2018-03-08 23:23:21 -0300 |
commit | 501308ea04a0fd8cee325f210ae994995f192edc (patch) | |
tree | 9db51ec566147b28e2757220ce305485f2f0df17 /test/clj | |
parent | de7cd8220c364dd816f4136a9d4c5a4d6618359d (diff) | |
download | queue-api-master.tar.gz queue-api-master.tar.bz2 queue-api-master.zip |
Diffstat (limited to 'test/clj')
-rw-r--r-- | test/clj/queue_api/test/db/core_test.clj | 33 | ||||
-rw-r--r-- | test/clj/queue_api/test/handler.clj | 3 |
2 files changed, 19 insertions, 17 deletions
diff --git a/test/clj/queue_api/test/db/core_test.clj b/test/clj/queue_api/test/db/core_test.clj index 4afa99d..2d4e511 100644 --- a/test/clj/queue_api/test/db/core_test.clj +++ b/test/clj/queue_api/test/db/core_test.clj @@ -4,7 +4,8 @@ [queue-api.db.core :refer :all] [datascript.core :as d] [clj-time.core :as time] - [mount.core :as mount])) + [mount.core :as mount]) + (:refer-clojure :exclude [agent])) (def base-schema "Scenario base for tests, it has most of combinations to simulate a real composition" @@ -122,7 +123,7 @@ tx-data (:tx-data tx)] (is (not (empty? tx-data)))))) -(deftest q-status-test +(deftest query-status-test (testing "Test query job by status" (are [left right] (= left right) @@ -131,12 +132,12 @@ ["f90e149e-fa51-4212-a6bf-8cf81c78d28c"] ["dfa7744f-8d61-4d37-885f-dbef2d4df13b"] ["c471f9e0-fbbd-461d-adb0-7466c2d9830f"] - ["6e90db58-7a6d-46e2-a02a-e33dc82e6e33"]} (q-status :unassigned) + ["6e90db58-7a6d-46e2-a02a-e33dc82e6e33"]} (query-status :unassigned) #{["1e0d939d-494b-48d2-9247-b5ae207a519a"] ["aa327540-4e24-47f4-9e9c-81cdd5195934"] - ["3cdc52fe-b538-40a6-a9d7-92fa840c2c4b"]} (q-status :completed) - #{["b201d085-91b5-4a13-9a74-7861426e9996"]} (q-status :processing) - #{} (q-status :nil)))) + ["3cdc52fe-b538-40a6-a9d7-92fa840c2c4b"]} (query-status :completed) + #{["b201d085-91b5-4a13-9a74-7861426e9996"]} (query-status :processing) + #{} (query-status :nil)))) (deftest sum-queue-test (testing "test get summary of the current state of the queue" @@ -152,20 +153,20 @@ "6e90db58-7a6d-46e2-a02a-e33dc82e6e33"]} (sum-queue))))) -(deftest q-job-test +(deftest query-job-test (testing "Test query job" (is (= [(job "96cf6f11-591d-4cde-9ab0-56e371acb6d2") (job "dfa7744f-8d61-4d37-885f-dbef2d4df13b")] - (q-job false :unassigned "rewards-question"))) + (query-job false :unassigned "rewards-question"))) (is (= [(job "b201d085-91b5-4a13-9a74-7861426e9996")] - (q-job true :processing "purchases-question"))) + (query-job true :processing "purchases-question"))) (is (= [(job "aa327540-4e24-47f4-9e9c-81cdd5195934")] - (q-job true :completed "bills-question"))) - (is (= [] (q-job false :completed "rewards-question"))) + (query-job true :completed "bills-question"))) + (is (= [] (query-job false :completed "rewards-question"))) (is (= [(job "1e0d939d-494b-48d2-9247-b5ae207a519a")] - (q-job false :completed "rewards-question" "bills-question"))) + (query-job false :completed "rewards-question" "bills-question"))) (is (= [(job "1e0d939d-494b-48d2-9247-b5ae207a519a")] - (q-job false :completed ["rewards-question" "bills-question"]))))) + (query-job false :completed ["rewards-question" "bills-question"]))))) (deftest agent-jobs-test (testing "Test fetch relation agent job" @@ -191,12 +192,12 @@ (is (= "51ab0771-f1e4-4268-868f-9029a58f6612" (-> a :agent/job :job/id)))))) -(deftest t-job-test +(deftest transact-job-test (testing "Test transact job" - (let [_ (t-job "51ab0771-f1e4-4268-868f-9029a58f6612" :completed) + (let [_ (transact-job "51ab0771-f1e4-4268-868f-9029a58f6612" :completed) j (job "51ab0771-f1e4-4268-868f-9029a58f6612")] (is (= :completed (:job/status j)))) - (let [_ (t-job "51ab0771-f1e4-4268-868f-9029a58f6612" :completed "644be0ce-035d-48cb-867e-8e6de2714a8d") + (let [_ (transact-job "51ab0771-f1e4-4268-868f-9029a58f6612" :completed "644be0ce-035d-48cb-867e-8e6de2714a8d") j (job "51ab0771-f1e4-4268-868f-9029a58f6612")] (are [left right] (= left right) diff --git a/test/clj/queue_api/test/handler.clj b/test/clj/queue_api/test/handler.clj index 0af1b9f..26c71b0 100644 --- a/test/clj/queue_api/test/handler.clj +++ b/test/clj/queue_api/test/handler.clj @@ -5,7 +5,8 @@ [queue-api.db.core :refer :all] [mount.core :as mount] [queue-api.test.db.core-test :refer [base-schema]] - [datascript.core :as d])) + [datascript.core :as d]) + (:refer-clojure :exclude [agent])) (use-fixtures :once |