Skip to content

Commit 2f2e10d

Browse files
committed
Updated convenience-entry tests
1 parent a811231 commit 2f2e10d

1 file changed

Lines changed: 33 additions & 3 deletions

File tree

test/convenience-entry.js

Lines changed: 33 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@ var git = require('../');
22

33
var sha = '5716e9757886eaf38d51c86b192258c960d9cfea';
44

5-
var getEntry = function(callback) {
5+
var getEntry = function(path, callback) {
66
git.repo('../.git', function(error, repo) {
77
repo.commit(sha, function(error, commit) {
8-
commit.file('README.md', function(error, entry) {
8+
commit.file(path, function(error, entry) {
99
callback(error, entry);
1010
});
1111
});
@@ -14,10 +14,40 @@ var getEntry = function(callback) {
1414

1515
exports.sha = function(test) {
1616
test.expect(1);
17-
getEntry(function(error, entry) {
17+
getEntry('README.md', function(error, entry) {
1818
entry.sha(function(error, sha) {
1919
test.equal(sha, '6cb45ba5d32532bf0d1310dc31ca4f20f59964bc', 'Entry SHA should match expected value');
2020
test.done();
2121
});
2222
});
2323
};
24+
25+
exports.isFile = function(test) {
26+
test.expect(2);
27+
getEntry('README.md', function(error, entry) {
28+
entry.isFile(function(error, isFile) {
29+
test.equal(isFile, true, 'Entry is a file');
30+
getEntry('example', function(error, entry) {
31+
entry.isFile(function(error, isFile) {
32+
test.equal(isFile, false, 'Entry is a directory');
33+
test.done();
34+
});
35+
});
36+
});
37+
});
38+
};
39+
40+
exports.isDirectory = function(test) {
41+
test.expect(2);
42+
getEntry('example', function(error, entry) {
43+
entry.isFile(function(error, isFile) {
44+
test.equal(isFile, false, 'Entry is a directory');
45+
getEntry('README.md', function(error, entry) {
46+
entry.isFile(function(error, isFile) {
47+
test.equal(isFile, true, 'Entry is a file');
48+
test.done();
49+
});
50+
});
51+
});
52+
});
53+
};

0 commit comments

Comments
 (0)