Skip to content

Commit 9354866

Browse files
committed
Organized test utils in a folder.
Eventually there should be more files in the test/utils folder for various types of test utilities.
1 parent 6a244ba commit 9354866

File tree

7 files changed

+69
-58
lines changed

7 files changed

+69
-58
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@
8282
"host": "https://nodegit.s3.amazonaws.com/nodegit/nodegit/"
8383
},
8484
"scripts": {
85-
"lint": "jshint lib test/tests examples lifecycleScripts",
85+
"lint": "jshint lib test/tests test/utils examples lifecycleScripts",
8686
"coveralls": "cat ./test/coverage/merged.lcov | coveralls",
8787
"filtercov": "lcov --extract test/coverage/cpp/lcov_full.info $(pwd)/src/* $(pwd)/src/**/* $(pwd)/include/* $(pwd)/include/**/* --output-file test/coverage/cpp/lcov.info && rm test/coverage/cpp/lcov_full.info",
8888
"cppcov": "mkdir -p test/coverage/cpp && lcov --gcov-tool $(which gcov) --capture --directory build/Release/obj.target/nodegit/src --output-file test/coverage/cpp/lcov_full.info",

test/index.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ if (process.platform === 'win32') {
1212
var args = cov.concat([
1313
"test/runner",
1414
"test/tests",
15-
"test/utils",
1615
"--expose-gc"
1716
]);
1817

test/tests/cherrypick.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@ var promisify = require("promisify-node");
55
var fse = promisify(require("fs-extra"));
66

77
describe("Cherrypick", function() {
8-
var TestUtils = require("../utils");
8+
var RepoUtils = require("../utils/repository_setup");
99
var NodeGit = require("../../");
1010
var Cherrypick = NodeGit.Cherrypick;
1111

1212
var repoPath = local("../repos/cherrypick");
1313

1414
beforeEach(function() {
1515
var test = this;
16-
return TestUtils.createRepository(repoPath)
16+
return RepoUtils.createRepository(repoPath)
1717
.then(function(repo) {
1818
test.repository = repo;
1919
});
@@ -28,7 +28,7 @@ describe("Cherrypick", function() {
2828
var workDirPath = repo.workdir();
2929
var repoInfo;
3030

31-
return TestUtils.setupBranches(repo, true)
31+
return RepoUtils.setupBranches(repo, true)
3232
.then(function(info) {
3333
repoInfo = info;
3434

@@ -50,7 +50,7 @@ describe("Cherrypick", function() {
5050
var workDirPath = repo.workdir();
5151
var repoInfo;
5252

53-
return TestUtils.setupBranches(repo)
53+
return RepoUtils.setupBranches(repo)
5454
.then(function(info) {
5555
repoInfo = info;
5656

@@ -96,7 +96,7 @@ describe("Cherrypick", function() {
9696

9797
var addedContent = "\nIt makes things E-Z!";
9898

99-
return TestUtils.setupBranches(repo, true)
99+
return RepoUtils.setupBranches(repo, true)
100100
.then(function(info) {
101101
repoInfo = info;
102102

test/tests/index.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ var writeFile = promisify(function(filename, data, callback) {
1010
});
1111

1212
describe("Index", function() {
13-
var TestUtils = require("../utils");
13+
var RepoUtils = require("../utils/repository_setup");
1414
var NodeGit = require("../../");
1515
var Repository = NodeGit.Repository;
1616

@@ -183,7 +183,7 @@ describe("Index", function() {
183183
baseFileContent);
184184
})
185185
.then(function() {
186-
return TestUtils.addFileToIndex(repository, fileName);
186+
return RepoUtils.addFileToIndex(repository, fileName);
187187
})
188188
.then(function(oid) {
189189
assert.equal(oid.toString(),
@@ -212,7 +212,7 @@ describe("Index", function() {
212212
baseFileContent + theirFileContent);
213213
})
214214
.then(function() {
215-
return TestUtils.addFileToIndex(repository, fileName);
215+
return RepoUtils.addFileToIndex(repository, fileName);
216216
})
217217
.then(function(oid) {
218218
assert.equal(oid.toString(),
@@ -229,7 +229,7 @@ describe("Index", function() {
229229
baseFileContent + ourFileContent);
230230
})
231231
.then(function() {
232-
return TestUtils.addFileToIndex(repository, fileName);
232+
return RepoUtils.addFileToIndex(repository, fileName);
233233
})
234234
.then(function(oid) {
235235
assert.equal(oid.toString(),

test/tests/merge.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,15 @@ fse.ensureDir = promisify(fse.ensureDir);
99

1010
describe("Merge", function() {
1111
var NodeGit = require("../../");
12-
var TestUtils = require("../utils");
12+
var RepoUtils = require("../utils/repository_setup");
1313

1414
var reposPath = local("../repos/merge");
1515
var ourBranchName = "ours";
1616
var theirBranchName = "theirs";
1717

1818
beforeEach(function() {
1919
var test = this;
20-
return TestUtils.createRepository(reposPath)
20+
return RepoUtils.createRepository(reposPath)
2121
.then(function(repo) {
2222
test.repository = repo;
2323
});

test/tests/rebase.js

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ var fse = promisify(require("fs-extra"));
77

88
describe("Rebase", function() {
99
var NodeGit = require("../../");
10-
var TestUtils = require("../utils");
10+
var RepoUtils = require("../utils/repository_setup");
1111

1212
var repoPath = local("../repos/rebase");
1313
var ourBranchName = "ours";
@@ -26,7 +26,7 @@ describe("Rebase", function() {
2626

2727
beforeEach(function() {
2828
var test = this;
29-
return TestUtils.createRepository(repoPath)
29+
return RepoUtils.createRepository(repoPath)
3030
.then(function(repo) {
3131
test.repository = repo;
3232
});
@@ -56,7 +56,7 @@ describe("Rebase", function() {
5656
ourFileContent)
5757
// Load up the repository index and make our initial commit to HEAD
5858
.then(function() {
59-
return TestUtils.addFileToIndex(repository, ourFileName);
59+
return RepoUtils.addFileToIndex(repository, ourFileName);
6060
})
6161
.then(function(oid) {
6262
assert.equal(oid.toString(),
@@ -84,7 +84,7 @@ describe("Rebase", function() {
8484
theirFileContent);
8585
})
8686
.then(function() {
87-
return TestUtils.addFileToIndex(repository, theirFileName);
87+
return RepoUtils.addFileToIndex(repository, theirFileName);
8888
})
8989
.then(function(oid) {
9090
assert.equal(oid.toString(),
@@ -167,7 +167,7 @@ describe("Rebase", function() {
167167
baseFileContent)
168168
// Load up the repository index and make our initial commit to HEAD
169169
.then(function() {
170-
return TestUtils.addFileToIndex(repository, baseFileName);
170+
return RepoUtils.addFileToIndex(repository, baseFileName);
171171
})
172172
.then(function(oid) {
173173
assert.equal(oid.toString(),
@@ -196,7 +196,7 @@ describe("Rebase", function() {
196196
theirFileContent);
197197
})
198198
.then(function() {
199-
return TestUtils.addFileToIndex(repository, theirFileName);
199+
return RepoUtils.addFileToIndex(repository, theirFileName);
200200
})
201201
.then(function(oid) {
202202
assert.equal(oid.toString(),
@@ -219,7 +219,7 @@ describe("Rebase", function() {
219219
ourFileContent);
220220
})
221221
.then(function() {
222-
return TestUtils.addFileToIndex(repository, ourFileName);
222+
return RepoUtils.addFileToIndex(repository, ourFileName);
223223
})
224224
.then(function(oid) {
225225
assert.equal(oid.toString(),
@@ -348,7 +348,7 @@ describe("Rebase", function() {
348348
return fse.writeFile(path.join(repository.workdir(), fileName),
349349
baseFileContent)
350350
.then(function() {
351-
return TestUtils.addFileToIndex(repository, fileName);
351+
return RepoUtils.addFileToIndex(repository, fileName);
352352
})
353353
.then(function(oid) {
354354
assert.equal(oid.toString(),
@@ -377,7 +377,7 @@ describe("Rebase", function() {
377377
baseFileContent + theirFileContent);
378378
})
379379
.then(function() {
380-
return TestUtils.addFileToIndex(repository, fileName);
380+
return RepoUtils.addFileToIndex(repository, fileName);
381381
})
382382
.then(function(oid) {
383383
assert.equal(oid.toString(),
@@ -394,7 +394,7 @@ describe("Rebase", function() {
394394
baseFileContent + ourFileContent);
395395
})
396396
.then(function() {
397-
return TestUtils.addFileToIndex(repository, fileName);
397+
return RepoUtils.addFileToIndex(repository, fileName);
398398
})
399399
.then(function(oid) {
400400
assert.equal(oid.toString(),
@@ -470,7 +470,7 @@ describe("Rebase", function() {
470470
});
471471
})
472472
.then(function() {
473-
return TestUtils.addFileToIndex(repository, fileName);
473+
return RepoUtils.addFileToIndex(repository, fileName);
474474
})
475475
.then(function(oid) {
476476
return repository.openIndex()
@@ -529,7 +529,7 @@ describe("Rebase", function() {
529529
baseFileContent)
530530
// Load up the repository index and make our initial commit to HEAD
531531
.then(function() {
532-
return TestUtils.addFileToIndex(repository, baseFileName);
532+
return RepoUtils.addFileToIndex(repository, baseFileName);
533533
})
534534
.then(function(oid) {
535535
assert.equal(oid.toString(),
@@ -558,7 +558,7 @@ describe("Rebase", function() {
558558
theirFileContent);
559559
})
560560
.then(function() {
561-
return TestUtils.addFileToIndex(repository, theirFileName);
561+
return RepoUtils.addFileToIndex(repository, theirFileName);
562562
})
563563
.then(function(oid) {
564564
assert.equal(oid.toString(),
@@ -581,7 +581,7 @@ describe("Rebase", function() {
581581
ourFileContent);
582582
})
583583
.then(function() {
584-
return TestUtils.addFileToIndex(repository, ourFileName);
584+
return RepoUtils.addFileToIndex(repository, ourFileName);
585585
})
586586
.then(function(oid) {
587587
assert.equal(oid.toString(),
@@ -706,7 +706,7 @@ describe("Rebase", function() {
706706
ourFileContent)
707707
// Load up the repository index and make our initial commit to HEAD
708708
.then(function() {
709-
return TestUtils.addFileToIndex(repository, ourFileName);
709+
return RepoUtils.addFileToIndex(repository, ourFileName);
710710
})
711711
.then(function(oid) {
712712
assert.equal(oid.toString(),
@@ -734,7 +734,7 @@ describe("Rebase", function() {
734734
theirFileContent);
735735
})
736736
.then(function() {
737-
return TestUtils.addFileToIndex(repository, theirFileName);
737+
return RepoUtils.addFileToIndex(repository, theirFileName);
738738
})
739739
.then(function(oid) {
740740
assert.equal(oid.toString(),
@@ -811,7 +811,7 @@ describe("Rebase", function() {
811811
baseFileContent)
812812
// Load up the repository index and make our initial commit to HEAD
813813
.then(function() {
814-
return TestUtils.addFileToIndex(repository, baseFileName);
814+
return RepoUtils.addFileToIndex(repository, baseFileName);
815815
})
816816
.then(function(oid) {
817817
assert.equal(oid.toString(),
@@ -840,7 +840,7 @@ describe("Rebase", function() {
840840
theirFileContent);
841841
})
842842
.then(function() {
843-
return TestUtils.addFileToIndex(repository, theirFileName);
843+
return RepoUtils.addFileToIndex(repository, theirFileName);
844844
})
845845
.then(function(oid) {
846846
assert.equal(oid.toString(),
@@ -863,7 +863,7 @@ describe("Rebase", function() {
863863
ourFileContent);
864864
})
865865
.then(function() {
866-
return TestUtils.addFileToIndex(repository, ourFileName);
866+
return RepoUtils.addFileToIndex(repository, ourFileName);
867867
})
868868
.then(function(oid) {
869869
assert.equal(oid.toString(),
@@ -935,7 +935,7 @@ describe("Rebase", function() {
935935
return fse.writeFile(path.join(repository.workdir(), fileName),
936936
baseFileContent)
937937
.then(function() {
938-
return TestUtils.addFileToIndex(repository, fileName);
938+
return RepoUtils.addFileToIndex(repository, fileName);
939939
})
940940
.then(function(oid) {
941941
assert.equal(oid.toString(),
@@ -964,7 +964,7 @@ describe("Rebase", function() {
964964
baseFileContent + theirFileContent);
965965
})
966966
.then(function() {
967-
return TestUtils.addFileToIndex(repository, fileName);
967+
return RepoUtils.addFileToIndex(repository, fileName);
968968
})
969969
.then(function(oid) {
970970
assert.equal(oid.toString(),
@@ -981,7 +981,7 @@ describe("Rebase", function() {
981981
baseFileContent + ourFileContent);
982982
})
983983
.then(function() {
984-
return TestUtils.addFileToIndex(repository, fileName);
984+
return RepoUtils.addFileToIndex(repository, fileName);
985985
})
986986
.then(function(oid) {
987987
assert.equal(oid.toString(),
@@ -1022,7 +1022,7 @@ describe("Rebase", function() {
10221022
});
10231023
})
10241024
.then(function() {
1025-
return TestUtils.addFileToIndex(repository, fileName);
1025+
return RepoUtils.addFileToIndex(repository, fileName);
10261026
})
10271027
.then(function(oid) {
10281028
return repository.openIndex()

0 commit comments

Comments
 (0)