Skip to content

Commit 0e93e48

Browse files
committed
Change to a single clone path
1 parent 4ed92b9 commit 0e93e48

File tree

1 file changed

+30
-31
lines changed

1 file changed

+30
-31
lines changed

test/tests/clone.js

Lines changed: 30 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,7 @@ describe("Clone", function() {
99
var Clone = require(local("../../lib/clone"));
1010
var NodeGit = require(local("../../"));
1111

12-
var http = local("../repos/http");
13-
var https = local("../repos/https");
14-
var ssh = local("../repos/ssh");
15-
var git = local("../repos/git");
16-
var file = local("../repos/file");
12+
var clonePath = local("../repos/clone");
1713

1814
var sshPublicKey = local("../id_rsa.pub");
1915
var sshPrivateKey = local("../id_rsa");
@@ -22,18 +18,23 @@ describe("Clone", function() {
2218
this.timeout(30000);
2319

2420
beforeEach(function() {
25-
return NodeGit.Promise.all([
26-
fse.remove(http),
27-
fse.remove(https),
28-
fse.remove(ssh),
29-
fse.remove(git),
30-
fse.remove(file)
31-
]).catch(function unhandledFunction(ex) {
32-
console.log(ex.message);
21+
return fse.remove(clonePath);
22+
});
23+
24+
afterEach(function(done) {
25+
if (this.repository) {
26+
this.repository.free();
27+
delete this.repository;
28+
}
29+
30+
process.nextTick(function() {
31+
gc();
32+
done();
3333
});
3434
});
3535

3636
it.skip("can clone with http", function() {
37+
var test = this;
3738
var url = "http://github.com/nodegit/test.git";
3839
var opts = {
3940
remoteCallbacks: {
@@ -43,13 +44,14 @@ describe("Clone", function() {
4344
}
4445
};
4546

46-
return Clone.clone(url, http, opts).then(function(repo) {
47+
return Clone.clone(url, clonePath, opts).then(function(repo) {
4748
assert.ok(repo instanceof Repository);
48-
repo.free();
49+
test.repository = repo;
4950
});
5051
});
5152

5253
it("can clone with https", function() {
54+
var test = this;
5355
var url = "https://github.com/nodegit/test.git";
5456
var opts = {
5557
remoteCallbacks: {
@@ -59,14 +61,14 @@ describe("Clone", function() {
5961
}
6062
};
6163

62-
return Clone.clone(url, https, opts).then(function(repo) {
64+
return Clone.clone(url, clonePath, opts).then(function(repo) {
6365
assert.ok(repo instanceof Repository);
64-
repo.stateCleanup();
65-
repo.free();
66+
test.repository = repo;
6667
});
6768
});
6869

6970
it("can clone with ssh", function() {
71+
var test = this;
7072
var url = "git@github.com:nodegit/test.git";
7173
var opts = {
7274
remoteCallbacks: {
@@ -79,14 +81,14 @@ describe("Clone", function() {
7981
}
8082
};
8183

82-
return Clone.clone(url, ssh, opts).then(function(repo) {
84+
return Clone.clone(url, clonePath, opts).then(function(repo) {
8385
assert.ok(repo instanceof Repository);
84-
repo.stateCleanup();
85-
repo.free();
86+
test.repository = repo;
8687
});
8788
});
8889

8990
it("can clone with ssh while manually loading a key", function() {
91+
var test = this;
9092
var url = "git@github.com:nodegit/test.git";
9193
var opts = {
9294
remoteCallbacks: {
@@ -103,10 +105,9 @@ describe("Clone", function() {
103105
}
104106
};
105107

106-
return Clone.clone(url, ssh, opts).then(function(repo) {
108+
return Clone.clone(url, clonePath, opts).then(function(repo) {
107109
assert.ok(repo instanceof Repository);
108-
repo.stateCleanup();
109-
repo.free();
110+
test.repository = repo;
110111
});
111112
});
112113

@@ -120,28 +121,26 @@ describe("Clone", function() {
120121
}
121122
};
122123

123-
return Clone.clone(url, git, opts).then(function(repo) {
124+
return Clone.clone(url, clonePath, opts).then(function(repo) {
124125
assert.ok(repo instanceof Repository);
125-
repo.stateCleanup();
126-
repo.free();
127126
});
128127
});
129128

130129
it("can clone with filesystem", function() {
130+
var test = this;
131131
var prefix = process.platform === "win32" ? "" : "file://";
132132
var url = prefix + local("../repos/empty");
133133

134-
return Clone.clone(url, file).then(function(repo) {
134+
return Clone.clone(url, clonePath).then(function(repo) {
135135
assert.ok(repo instanceof Repository);
136-
repo.stateCleanup();
137-
repo.free();
136+
test.repository = repo;
138137
});
139138
});
140139

141140
it("will not segfault when accessing a url without username", function() {
142141
var url = "https://github.com/nodegit/private";
143142

144-
return Clone.clone(url, git, {
143+
return Clone.clone(url, clonePath, {
145144
remoteCallbacks: {
146145
certificateCheck: function() {
147146
return 1;

0 commit comments

Comments
 (0)