Permalink
Browse files

Added end-to-end conversion and export test.

  • Loading branch information...
konrad-garus committed Sep 8, 2012
1 parent 20bad07 commit cdd0162183e9fbb5006671a349e4c994369f2a26
Showing with 53 additions and 3 deletions.
  1. +3 −1 .gitignore
  2. +42 −2 test/ghijira/core_test.clj
  3. +8 −0 testdata/expected_jira.csv
View
@@ -6,6 +6,8 @@
/.lein-failures
/checkouts
/.lein-deps-sum
-*.csv
+JIRA-*.csv
+JIRA.csv
/config-OD
*history*
+/target
View
@@ -2,8 +2,48 @@
(:use ghijira.core)
(:use clojure.test))
-(deftest should-identify-mising-issues
+(deftest should-identify-mising-issues-in-the-middle
(let [issues [{:number 3 :title "Third"} {:number 1 :title "First"}]]
- (is (= [2] (find-missing-issues issues))))
+ (is (= [2] (find-missing-issues issues)))))
+
+(deftest should-identify-missing-issues-from-number-1
(let [issues [{:number 3 :title "Third"} ]]
(is (= [1 2] (find-missing-issues issues)))))
+
+;; End-to-end test
+(deftest should-export-all-issues-in-proper-format-and-order
+ (let [issue1 {:number 1
+ :title "First"
+ :body "First issue"
+ :created_at "2012-09-08T15:00:00Z"
+ :updated_at "2012-09-08T15:15:00Z"
+ :milestone "M1"
+ :state "open"
+ :user "anne"
+ :comment-contents []}
+ issue2 {:number 2
+ :title "Second"
+ :body "Second issue"
+ :created_at "2012-09-08T16:00:00Z"
+ :updated_at "2012-09-08T16:15:00Z"
+ :milestone "M2"
+ :state "closed"
+ :user "betty"
+ :comment-contents [{:user "betty"
+ :created_at "2012-09-08T16:13:00Z"
+ :body "First comment by betty"}
+ {:user "anne"
+ :created_at "2012-09-08T16:15:00Z"
+ :body "Second comment by anne"}]}
+ issue3 {:number 3
+ :title "Third"
+ :body "Third issue"
+ :created_at "2012-09-08T17:00:00Z"
+ :updated_at "2012-09-08T17:15:00Z"
+ :milestone "M3"
+ :state "open"
+ :user "anne"
+ :comment-contents []}
+ issues [issue3 issue1 issue2]] ; random order
+ (export-issues-to-file issues "testdata/temp/out.csv")
+ (is (= (slurp "testdata/expected_jira.csv") (slurp"testdata/temp/out.csv")))))
@@ -0,0 +1,8 @@
+Issue Id,Summary,Description,Date Created,Date Modified,Issue type,Milestone,Status,Reporter,Comments,Comments,Comments,Comments,Comments,Comments,Comments,Comments,Comments,Comments,Comments,Comments,Comments,Comments,Comments,Comments,Comments,Comments,Comments,Comments,Comments,Comments,Comments,Comments,Comments
+1,First,First issue,09/08/12 03:00:00 PM,09/08/12 03:15:00 PM,Task,,Open,,,,,,,,,,,,,,,,,,,,,,,,,,
+2,Second,Second issue,09/08/12 04:00:00 PM,09/08/12 04:15:00 PM,Task,,Closed,,"Comment::09/08/12 04:13:00 PM:
+
+First comment by betty","Comment::09/08/12 04:15:00 PM:
+
+Second comment by anne",,,,,,,,,,,,,,,,,,,,,,,
+3,Third,Third issue,09/08/12 05:00:00 PM,09/08/12 05:15:00 PM,Task,,Open,,,,,,,,,,,,,,,,,,,,,,,,,,

0 comments on commit cdd0162

Please sign in to comment.