diff --git a/test/tests/index.js b/test/tests/index.js index a1f91b204..ff0fb6d35 100644 --- a/test/tests/index.js +++ b/test/tests/index.js @@ -311,7 +311,7 @@ describe("Index", function() { it("can add a conflict to the index", function() { var repo; - var repoPath = path.join(__dirname, "..", "repos", "index"); + var repoPath = local("../repos/index"); var ourBranchName = "ours"; var theirBranchName = "theirs"; var fileName = "testFile.txt"; @@ -329,6 +329,10 @@ describe("Index", function() { fileName ); }) + .then(function(index) { + assert.ok(index.hasConflicts()); + return index.conflictGet(fileName); + }) .then(function(indexEntries) { // Store all indexEntries for conflict ancestorIndexEntry = indexEntries.ancestor_out; diff --git a/test/utils/index_setup.js b/test/utils/index_setup.js index a55e95924..eafcd5b52 100644 --- a/test/utils/index_setup.js +++ b/test/utils/index_setup.js @@ -1,4 +1,3 @@ -var assert = require("assert"); var NodeGit = require("../../"); var path = require("path"); var promisify = require("promisify-node"); @@ -75,25 +74,18 @@ var IndexSetup = { return repository.createCommit(ourBranch.name(), ourSignature, ourSignature, "we made a commit", oid, [ourCommit]); }) - .then(function(commitOid) { - var opts = { - checkoutStrategy: NodeGit.Checkout.STRATEGY.FORCE - }; - - return NodeGit.Checkout.head(repository, opts); + .then(function() { + return repository.checkoutBranch( + ourBranch, + new NodeGit.CheckoutOptions() + ); }) .then(function() { return repository.mergeBranches(ourBranchName, theirBranchName); }) - .then(function(commit) { - assert.fail(commit, undefined, - "The index should have been thrown due to merge conflicts"); - }) .catch(function(index) { - assert.ok(index); - assert.ok(index.hasConflicts()); - - return index.conflictGet(fileName); + return NodeGit.Checkout.index(repository, index) + .then(function() { return index; }); }); } };