Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Added end-to-end conversion and export test.

  • Loading branch information...
commit cdd0162183e9fbb5006671a349e4c994369f2a26 1 parent 20bad07
@konrad-garus konrad-garus authored
View
4 .gitignore
@@ -6,6 +6,8 @@
/.lein-failures
/checkouts
/.lein-deps-sum
-*.csv
+JIRA-*.csv
+JIRA.csv
/config-OD
*history*
+/target
View
44 test/ghijira/core_test.clj
@@ -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")))))
View
8 testdata/expected_jira.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,,,,,,,,,,,,,,,,,,,,,,,,,,
Please sign in to comment.
Something went wrong with that request. Please try again.