Skip to content

Commit bf8f05d

Browse files
committed
Expanded convenience-entry tests
1 parent 1af7369 commit bf8f05d

1 file changed

Lines changed: 70 additions & 0 deletions

File tree

test/convenience-entry.js

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,15 @@ var getEntry = function(path, callback) {
1212
});
1313
};
1414

15+
exports.missingFile = function(test) {
16+
test.expect(1);
17+
18+
getEntry('test/convenience-entry.js', function(error, entry) {
19+
test.notEqual(error, null, 'Missing file should error');
20+
test.done();
21+
});
22+
};
23+
1524
exports.sha = function(test) {
1625
test.expect(1);
1726
getEntry('README.md', function(error, entry) {
@@ -51,3 +60,64 @@ exports.isDirectory = function(test) {
5160
});
5261
});
5362
};
63+
64+
exports.name = function(test) {
65+
test.expect(2);
66+
getEntry('test/raw-commit.js', function(error, entry) {
67+
test.equal(error, null, 'Should not error');
68+
entry.name(function(error, name) {
69+
test.equal(name, 'raw-commit.js', 'Name should match expected value');
70+
test.done();
71+
});
72+
});
73+
};
74+
75+
exports.root = function(test) {
76+
test.expect(1);
77+
getEntry('test/raw-commit.js', function(error, entry) {
78+
entry.root(function(error, root) {
79+
test.equal(root, 'test', 'Root should match expected value');
80+
test.done();
81+
});
82+
});
83+
};
84+
85+
exports.path = function(test) {
86+
test.expect(1);
87+
getEntry('test/raw-commit.js', function(error, entry) {
88+
entry.path(function(error, path) {
89+
test.equal(path, 'test/raw-commit.js', 'Path should match expected value');
90+
test.done();
91+
});
92+
});
93+
};
94+
95+
exports.content = function(test) {
96+
test.expect(1);
97+
getEntry('test/raw-commit.js', function(error, entry) {
98+
entry.content(function(error, content) {
99+
test.equal(content.length, 2736, 'Content length should match expected value');
100+
test.done();
101+
});
102+
});
103+
};
104+
105+
exports.toBlob = function(test) {
106+
test.expect(1);
107+
getEntry('test/raw-commit.js', function(error, entry) {
108+
entry.toBlob(function(error, blob) {
109+
test.equal(blob instanceof git.blob, true, 'Expected instance of Blob');
110+
test.done();
111+
});
112+
});
113+
};
114+
115+
exports.tree = function(test) {
116+
test.expect(1);
117+
getEntry('test', function(error, entry) {
118+
entry.tree(function(error, tree) {
119+
test.equal(tree instanceof git.tree, true, 'Expected instance of Tree');
120+
test.done();
121+
});
122+
});
123+
};

0 commit comments

Comments
 (0)