-
-
Notifications
You must be signed in to change notification settings - Fork 320
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #346 from steveukx/Issue-345
Add integration test for `checkIsRepo`
- Loading branch information
Showing
1 changed file
with
46 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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'); | ||
}); | ||
}), | ||
}; |