Skip to content

Commit 8dae43a

Browse files
Add test for Tree#createUpdated
1 parent bb4c0bd commit 8dae43a

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

test/tests/tree.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,24 @@ describe("Tree", function() {
3939
}).done(done);
4040
});
4141

42+
it("updates a tree", function () {
43+
var repo = this.existingRepo;
44+
var update = new NodeGit.TreeUpdate();
45+
update.action = NodeGit.Tree.UPDATE.REMOVE;
46+
update.path = "README.md";
47+
return this.commit.getTree().then(function(tree) {
48+
return tree.createUpdated(repo, 1, [update]);
49+
})
50+
.then(function(treeOid) {
51+
return repo.getTree(treeOid);
52+
})
53+
.then(function(updatedTree) {
54+
assert.throws(function () {
55+
updatedTree.entryByName("README.md");
56+
});
57+
});
58+
});
59+
4260
it("walks its entries and returns the same entries on both progress and end",
4361
function() {
4462
var repo = this.repository;

0 commit comments

Comments
 (0)