Skip to content

Commit f3615da

Browse files
committed
Write some failing tests
1 parent 5e76dfa commit f3615da

1 file changed

Lines changed: 23 additions & 0 deletions

File tree

test/tests/diff.js

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,4 +109,27 @@ describe("Diff", function() {
109109
"1 line\n"
110110
);
111111
});
112+
113+
it("can diff with a null tree", function(done) {
114+
var repo = this.repository;
115+
var tree = this.masterCommitTree;
116+
Diff.treeToTree(repo, null, tree, null).then(function(diff) {
117+
assert.equal(diff.patches().length, 85);
118+
done();
119+
}, function(error) {
120+
console.log(error);
121+
done(error);
122+
});
123+
});
124+
125+
it("can diff the initial commit of a repository", function(done) {
126+
var repo = this.repository;
127+
var oid = "99c88fd2ac9c5e385bd1fe119d89c83dce326219"; // First commit
128+
repo.getCommit(oid).then(function(commit) {
129+
commit.getDiff().then(function(diffs) {
130+
assert.equal(diffs[0].patches().length, 8);
131+
done();
132+
}, function (error) { done(error); });
133+
}, function(error) { done(error); });
134+
});
112135
});

0 commit comments

Comments
 (0)