@@ -10,11 +10,13 @@ describe("Remote", function() {
1010
1111 var reposPath = local ( "../repos/workdir/.git" ) ;
1212 var url = "https://github.com/nodegit/test" ;
13+ var url2 = "https://github.com/nodegit/test2" ;
1314
1415 function removeOrigins ( repository ) {
1516 Remote . delete ( repository , "origin1" ) ;
1617 Remote . delete ( repository , "origin2" ) ;
1718 Remote . delete ( repository , "origin3" ) ;
19+ Remote . delete ( repository , "test2" ) ;
1820 }
1921
2022 before ( function ( ) {
@@ -110,6 +112,40 @@ describe("Remote", function() {
110112 } ) ;
111113 } ) ;
112114
115+ it ( "can monitor transfer progress while downloading" , function ( ) {
116+ // Set a reasonable timeout here now that our repository has grown.
117+ this . timeout ( 600000 ) ;
118+
119+ var repo = this . repository ;
120+ var wasCalled = false ;
121+
122+ return Remote . create ( repo , "test2" , url2 )
123+ . then ( function ( ) {
124+ return repo . getRemote ( "test2" ) ;
125+ } )
126+ . then ( function ( remote ) {
127+ remote . setCallbacks ( {
128+ credentials : function ( url , userName ) {
129+ return NodeGit . Cred . sshKeyFromAgent ( userName ) ;
130+ } ,
131+ certificateCheck : function ( ) {
132+ return 1 ;
133+ } ,
134+
135+ transferProgress : function ( ) {
136+ wasCalled = true ;
137+ }
138+ } ) ;
139+
140+ return remote . fetch ( null , repo . defaultSignature ( ) , null ) ;
141+ } )
142+ . then ( function ( ) {
143+ assert . ok ( wasCalled ) ;
144+
145+ Remote . delete ( repo , "test2" ) ;
146+ } ) ;
147+ } ) ;
148+
113149 it ( "can fetch from a remote" , function ( ) {
114150 return this . repository . fetch ( "origin" , {
115151 credentials : function ( url , userName ) {
0 commit comments