PageRenderTime 52ms CodeModel.GetById 25ms RepoModel.GetById 1ms app.codeStats 0ms

/pelrapeire/test/pelrapeire/views/projects/uid/home_view_test.clj

https://github.com/mderosa/nimcram
Clojure | 48 lines | 41 code | 7 blank | 0 comment | 8 complexity | 8e46d95659c94b3643d4ed8f75da67a6 MD5 | raw file
  1. (ns pelrapeire.views.projects.uid.home-view-test
  2. (:use pelrapeire.views.projects.uid.home-view
  3. clojure.contrib.trace
  4. clojure.test))
  5. (def test-task
  6. {"taskStartDate" [2010 7 6 21 10 0],
  7. "specification" "should be queryable so that give an project name we can obtain all the tasks for that project",
  8. "_rev" "3-f0c26eae64651811fffd4a1bf534ea23",
  9. "deliversUserFunctionality" true,
  10. "progress" "delivered",
  11. "solutionTeam" ["marc.derosa@gmail.com"],
  12. "title" "create project task view",
  13. "project" "PicoMinMin",
  14. "taskCompleteDate" [2010 7 6 22 21 0],
  15. "_id" "70ab59880b829b4ad4fbd56d6a068da1",
  16. "type" "task"})
  17. (deftest test-make-tasks-none
  18. (testing "we should return an empty vector when there are no tasks in the
  19. task list that satisfy the progress designation"
  20. (let [actual (make-tasks [test-task] "proposed")]
  21. (is (= [] actual)))))
  22. (deftest test-make-tasks-one
  23. (testing "we should return an non empty vector of tables when there are tasks in the
  24. task list that satisfy the progress designation"
  25. (let [actual (make-tasks [test-task] "delivered")]
  26. (is (= 1 (.size actual)))
  27. (is (= :table (first (first actual)))))))
  28. (deftest test-make-priority-display1
  29. (testing "a nil value of 'priority' should show 3 off stars"
  30. (let [actual (make-priority-display {"_id" "3dkiee33"})]
  31. (is (= :td (first actual)))
  32. (is (= "/img/star-off.gif" (:src (nth (nth actual 2) 1))))
  33. (is (= 5 (count actual))))))
  34. (deftest test-make-priority-display2
  35. (testing "a priority value of 2 should display 2 on and 1 off star, in that order"
  36. (let [actual (make-priority-display {"priority" 2})]
  37. (is (= "/img/star-on.gif" (:src (nth (nth actual 3) 1))))
  38. (is (= "/img/star-off.gif" (:src (nth (nth actual 4) 1)))))))
  39. (deftest test-make-priority-display3
  40. (testing "values less than 1 and greater than 3 are not allowed"
  41. (is (thrown? IllegalArgumentException (make-priority-display {"priority" 5})))))