@@ -5,9 +5,9 @@ var fse = promisify(require("fs-extra"));
55var local = path . join . bind ( path , __dirname ) ;
66
77describe ( "Clone" , function ( ) {
8- var Repository = require ( local ( "../../lib/repository" ) ) ;
9- var clone = require ( local ( "../../lib/clone" ) ) ;
108 var NodeGit = require ( local ( "../../" ) ) ;
9+ var Repository = NodeGit . Repository ;
10+ var Clone = NodeGit . Clone ;
1111
1212 var clonePath = local ( "../repos/clone" ) ;
1313
@@ -29,7 +29,7 @@ describe("Clone", function() {
2929 var test = this ;
3030 var url = "http://git.tbranyen.com/smart/site-content" ;
3131
32- return clone ( url , clonePath ) . then ( function ( repo ) {
32+ return Clone ( url , clonePath ) . then ( function ( repo ) {
3333 assert . ok ( repo instanceof Repository ) ;
3434 test . repository = repo ;
3535 } ) ;
@@ -46,7 +46,24 @@ describe("Clone", function() {
4646 }
4747 } ;
4848
49- return clone ( url , clonePath , opts ) . then ( function ( repo ) {
49+ return Clone ( url , clonePath , opts ) . then ( function ( repo ) {
50+ assert . ok ( repo instanceof Repository ) ;
51+ test . repository = repo ;
52+ } ) ;
53+ } ) ;
54+
55+ it ( "can clone using nested function" , function ( ) {
56+ var test = this ;
57+ var url = "https://github.com/nodegit/test.git" ;
58+ var opts = {
59+ remoteCallbacks : {
60+ certificateCheck : function ( ) {
61+ return 1 ;
62+ }
63+ }
64+ } ;
65+
66+ return Clone . clone ( url , clonePath , opts ) . then ( function ( repo ) {
5067 assert . ok ( repo instanceof Repository ) ;
5168 test . repository = repo ;
5269 } ) ;
@@ -66,7 +83,7 @@ describe("Clone", function() {
6683 }
6784 } ;
6885
69- return clone ( url , clonePath , opts ) . then ( function ( repo ) {
86+ return Clone ( url , clonePath , opts ) . then ( function ( repo ) {
7087 assert . ok ( repo instanceof Repository ) ;
7188 test . repository = repo ;
7289 } ) ;
@@ -90,7 +107,7 @@ describe("Clone", function() {
90107 }
91108 } ;
92109
93- return clone ( url , clonePath , opts ) . then ( function ( repo ) {
110+ return Clone ( url , clonePath , opts ) . then ( function ( repo ) {
94111 assert . ok ( repo instanceof Repository ) ;
95112 test . repository = repo ;
96113 } ) ;
@@ -107,7 +124,7 @@ describe("Clone", function() {
107124 }
108125 } ;
109126
110- return clone ( url , clonePath , opts ) . then ( function ( repo ) {
127+ return Clone ( url , clonePath , opts ) . then ( function ( repo ) {
111128 test . repository = repo ;
112129 assert . ok ( repo instanceof Repository ) ;
113130 } ) ;
@@ -118,7 +135,7 @@ describe("Clone", function() {
118135 var prefix = process . platform === "win32" ? "" : "file://" ;
119136 var url = prefix + local ( "../repos/empty" ) ;
120137
121- return clone ( url , clonePath ) . then ( function ( repo ) {
138+ return Clone ( url , clonePath ) . then ( function ( repo ) {
122139 assert . ok ( repo instanceof Repository ) ;
123140 test . repository = repo ;
124141 } ) ;
@@ -127,7 +144,7 @@ describe("Clone", function() {
127144 it ( "will not segfault when accessing a url without username" , function ( ) {
128145 var url = "https://github.com/nodegit/private" ;
129146
130- return clone ( url , clonePath , {
147+ return Clone ( url , clonePath , {
131148 remoteCallbacks : {
132149 certificateCheck : function ( ) {
133150 return 1 ;
0 commit comments