aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorGabe Hayes <[email protected]>2013-07-29 10:47:56 -0700
committerGabe Hayes <[email protected]>2013-07-29 10:47:56 -0700
commitecb13e11c3d7dd29552e5872329d8d0ea4a18fde (patch)
tree6af13b363607acc20a2130f4f1b46ac3be7c6ad1 /test
parent598554ce00cc0096de3368b522f97b4b3024ca54 (diff)
downloadnode-coveralls-ecb13e11c3d7dd29552e5872329d8d0ea4a18fde.tar.xz
node-coveralls-ecb13e11c3d7dd29552e5872329d8d0ea4a18fde.zip
added full test coverage on fetchGitData
Diffstat (limited to 'test')
-rw-r--r--test/fetchGitData.js94
1 files changed, 93 insertions, 1 deletions
diff --git a/test/fetchGitData.js b/test/fetchGitData.js
index aa5e2b2..c8ddbc5 100644
--- a/test/fetchGitData.js
+++ b/test/fetchGitData.js
@@ -77,7 +77,73 @@ describe("fetchGitData", function(){
]
});
});
- it("execute git commands when a valid commit hash is given", function() {
+ it("should convert git.branch to a string", function() {
+ var objectToString = git({
+ "head": {
+ "id": "COMMIT_HASH"
+ },
+ "branch": {
+ "covert": "to a string"
+ }
+ });
+ var arrayToString = git({
+ "head": {
+ "id": "COMMIT_HASH"
+ },
+ "branch": ["convert", "to", "a", "string"]
+ });
+ objectToString.branch.should.be.a("string");
+ arrayToString.branch.should.be.a("string");
+ });
+ it("should convert git.remotes to an array", function() {
+ var stringToArray = git({
+ "head": {
+ "id": "COMMIT_HASH"
+ },
+ "remotes": "convert from string to an array"
+ });
+ var objectToArray = git({
+ "head": {
+ "id": "COMMIT_HASH"
+ },
+ "remotes": {
+ "convert": "from object to an array"
+ }
+ });
+ stringToArray.remotes.should.be.instanceof(Array);
+ objectToArray.remotes.should.be.instanceof(Array);
+ });
+ it("should save passed remotes", function() {
+ var options = git({
+ "head": {
+ "id": "COMMIT_HASH"
+ },
+ "remotes": [
+ {
+ "name": "test",
+ "url": "https://my.test.url"
+ }
+ ]
+ });
+ options.should.eql({
+ "head": {
+ "id": "COMMIT_HASH",
+ "author_name": "Unknown Author",
+ "author_email": "",
+ "committer_name": "Unknown Committer",
+ "committer_email": "",
+ "message": "Unknown Commit Message"
+ },
+ "branch": "",
+ "remotes": [
+ {
+ "name": "test",
+ "url": "https://my.test.url"
+ }
+ ]
+ });
+ });
+ it("should execute git commands when a valid commit hash is given", function() {
var options = git({
"head": {
"id": "5eaec7e76af0743f9764e617472ef434f283a195"
@@ -96,4 +162,30 @@ describe("fetchGitData", function(){
options.remotes.should.be.instanceof(Array);
options.remotes.length.should.be.above(0);
});
+ it("should combine passed remotes with git remotes when a valid commit hash is given", function() {
+ var options = git({
+ "head": {
+ "id": "5eaec7e76af0743f9764e617472ef434f283a195"
+ },
+ "remotes": [
+ {
+ "name": "test",
+ "url": "https://my.test.url"
+ }
+ ]
+ });
+ options.head.should.eql({
+ "id": "5eaec7e76af0743f9764e617472ef434f283a195",
+ "author_name": "cainus",
+ "author_email": "[email protected]",
+ "committer_name": "cainus",
+ "committer_email": "[email protected]",
+ "message": "first commit"
+ });
+ options.branch.should.equal("master");
+ options.remotes.should.includeEql({
+ "name": "test",
+ "url": "https://my.test.url"
+ });
+ });
});