@@ -5,6 +5,8 @@ var testUser = require('./user.json');
5
5
var github , issues ;
6
6
7
7
describe ( 'Github.Issue' , function ( ) {
8
+ var issue ;
9
+
8
10
before ( function ( ) {
9
11
github = new Github ( {
10
12
username : testUser . USERNAME ,
@@ -21,45 +23,41 @@ describe('Github.Issue', function() {
21
23
xhr . should . be . instanceof ( XMLHttpRequest ) ;
22
24
issues . should . have . length . above ( 0 ) ;
23
25
26
+ issue = issues [ 0 ] ;
27
+
24
28
done ( ) ;
25
29
} ) ;
26
30
} ) ;
27
31
28
32
it ( 'should post issue comment' , function ( done ) {
29
- issues . list ( { } , function ( err , issuesList ) {
30
- issues . comment ( issuesList [ 0 ] , 'Comment test' , function ( err , res , xhr ) {
31
- should . not . exist ( err ) ;
32
- xhr . should . be . instanceof ( XMLHttpRequest ) ;
33
- res . body . should . equal ( 'Comment test' ) ;
33
+ issues . comment ( issue , 'Comment test' , function ( err , res , xhr ) {
34
+ should . not . exist ( err ) ;
35
+ xhr . should . be . instanceof ( XMLHttpRequest ) ;
36
+ res . body . should . equal ( 'Comment test' ) ;
34
37
35
- done ( ) ;
36
- } ) ;
38
+ done ( ) ;
37
39
} ) ;
38
40
} ) ;
39
41
40
42
it ( 'should edit issues title' , function ( done ) {
41
- issues . list ( { } , function ( err , issuesList ) {
42
- issues . edit ( issuesList [ 0 ] . number , {
43
- title : 'Edited title'
44
- } , function ( err , res , xhr ) {
45
- should . not . exist ( err ) ;
46
- xhr . should . be . instanceof ( XMLHttpRequest ) ;
47
- res . title . should . equal ( 'Edited title' ) ;
43
+ issues . edit ( issue . number , {
44
+ title : 'Edited title'
45
+ } , function ( err , res , xhr ) {
46
+ should . not . exist ( err ) ;
47
+ xhr . should . be . instanceof ( XMLHttpRequest ) ;
48
+ res . title . should . equal ( 'Edited title' ) ;
48
49
49
- done ( ) ;
50
- } ) ;
50
+ done ( ) ;
51
51
} ) ;
52
52
} ) ;
53
53
54
54
it ( 'should get issue' , function ( done ) {
55
- issues . list ( { } , function ( err , issuesList ) {
56
- issues . get ( issuesList [ 0 ] . number , function ( err , res , xhr ) {
57
- should . not . exist ( err ) ;
58
- xhr . should . be . instanceof ( XMLHttpRequest ) ;
59
- res . number . should . equal ( issuesList [ 0 ] . number ) ;
55
+ issues . get ( issue . number , function ( err , res , xhr ) {
56
+ should . not . exist ( err ) ;
57
+ xhr . should . be . instanceof ( XMLHttpRequest ) ;
58
+ res . number . should . equal ( issue . number ) ;
60
59
61
- done ( ) ;
62
- } ) ;
60
+ done ( ) ;
63
61
} ) ;
64
62
} ) ;
65
63
} ) ;
0 commit comments