diff --git a/lib/git-hooks.js b/lib/git-hooks.js index a2c3977..f7f911c 100644 --- a/lib/git-hooks.js +++ b/lib/git-hooks.js @@ -90,9 +90,8 @@ module.exports = { throw new Error('git-hooks is not installed'); } - fsHelpers.removeDir(hooksPath); - if (fsHelpers.exists(hooksOldPath)) { + fsHelpers.removeDir(hooksPath); fs.renameSync(hooksOldPath, hooksPath); } }, diff --git a/tests/uninstall.test.js b/tests/uninstall.test.js index 25d680a..f15673e 100644 --- a/tests/uninstall.test.js +++ b/tests/uninstall.test.js @@ -38,14 +38,14 @@ describe('--uninstall', function () { }); }); - describe('when git-hooks is installed', function () { + describe('when backup is absent', function () { beforeEach(function () { fsHelpers.makeDir(GIT_HOOKS); }); - it('should remove hooks directory', function () { + it('should not remove hooks directory', function () { gitHooks.uninstall(SANDBOX_PATH); - fsHelpers.exists(GIT_HOOKS).should.be.false; + fsHelpers.exists(GIT_HOOKS).should.be.true; }); });