Skip to content

Commit

Permalink
Merge pull request #346 from steveukx/Issue-345
Browse files Browse the repository at this point in the history
Add integration test for `checkIsRepo`
  • Loading branch information
steveukx committed Apr 18, 2019
2 parents d8dd36d + 03aa287 commit 7ef11d7
Showing 1 changed file with 46 additions and 0 deletions.
46 changes: 46 additions & 0 deletions test/integration/test-check-is-repo.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
'use strict';

const FS = require('fs');
const Test = require('./include/runner');

const setUp = (context) => {

context.realRoot = context.dir('real-root');
context.realSubRoot = context.dir('real-root/foo');
context.fakeRoot = context.dir('fake-root');

return context.gitP(context.realRoot).init();
};

module.exports = {
'reports true for a real root': new Test(setUp, function (context, assert) {
const expected = true;
const git = context.gitP(context.realRoot);

return git.checkIsRepo()
.then((actual) => {
assert.equals(actual, expected, 'Should be a repo');
});

}),

'reports true for a child directory of a real root': new Test(setUp, function (context, assert) {
const expected = true;
const git = context.gitP(context.realSubRoot);

return git.checkIsRepo()
.then((actual) => {
assert.equals(actual, expected, 'Should be a repo');
});
}),

'reports false for a non-root': new Test(setUp, function (context, assert) {
const expected = false;
const git = context.gitP(context.fakeRoot);

return git.checkIsRepo()
.then((actual) => {
assert.equals(actual, expected, 'Should be a repo');
});
}),
};

0 comments on commit 7ef11d7

Please sign in to comment.