-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: getTimestamp, add timestamp (#112)
feat: getTimestamp, add timestamp
- Loading branch information
Showing
8 changed files
with
51 additions
and
29 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
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
exports['commit-info combination with environment variables has certain api 1'] = [ | ||
exports['commit-info no environment variables has certain api 1'] = [ | ||
"commitInfo", | ||
"getBranch", | ||
"getMessage", | ||
|
@@ -7,19 +7,31 @@ exports['commit-info combination with environment variables has certain api 1'] | |
"getSha", | ||
"getRemoteOrigin", | ||
"getSubject", | ||
"getTimestamp", | ||
"getBody" | ||
] | ||
|
||
exports['commit-info combination with environment variables returns information 1'] = { | ||
exports['commit-info no environment variables returns information 1'] = { | ||
"branch": "test-branch", | ||
"message": "some git message", | ||
"email": "user@company.com", | ||
"message": "important commit", | ||
"email": "me@foo.com", | ||
"author": "John Doe", | ||
"sha": "abc123", | ||
"remote": "[email protected]/repo" | ||
"remote": "[email protected]/repo", | ||
"timestamp": "123" | ||
} | ||
|
||
exports['commit-info no environment variables has certain api 1'] = [ | ||
exports['commit-info no environment variables returns nulls for missing fields 1'] = { | ||
"branch": "test-branch", | ||
"message": null, | ||
"email": "[email protected]", | ||
"author": null, | ||
"sha": "abc123", | ||
"remote": null, | ||
"timestamp": "123" | ||
} | ||
|
||
exports['commit-info combination with environment variables has certain api 1'] = [ | ||
"commitInfo", | ||
"getBranch", | ||
"getMessage", | ||
|
@@ -28,23 +40,16 @@ exports['commit-info no environment variables has certain api 1'] = [ | |
"getSha", | ||
"getRemoteOrigin", | ||
"getSubject", | ||
"getTimestamp", | ||
"getBody" | ||
] | ||
|
||
exports['commit-info no environment variables returns information 1'] = { | ||
exports['commit-info combination with environment variables returns information 1'] = { | ||
"branch": "test-branch", | ||
"message": "important commit", | ||
"email": "me@foo.com", | ||
"message": "some git message", | ||
"email": "user@company.com", | ||
"author": "John Doe", | ||
"sha": "abc123", | ||
"remote": "[email protected]/repo" | ||
} | ||
|
||
exports['commit-info no environment variables returns nulls for missing fields 1'] = { | ||
"branch": "test-branch", | ||
"message": null, | ||
"email": "[email protected]", | ||
"author": null, | ||
"sha": "abc123", | ||
"remote": null | ||
"remote": "[email protected]/repo", | ||
"timestamp": "123" | ||
} |
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 |
---|---|---|
@@ -1,12 +1,13 @@ | ||
exports['git-api subject and body gets subject and body 1'] = { | ||
"subject": "commit does this", | ||
"body": "more details" | ||
} | ||
|
||
exports['git-api getting commit info works 1'] = { | ||
"message": "important commit", | ||
"email": "[email protected]", | ||
"author": "John Doe", | ||
"sha": "abc123", | ||
"remote": "[email protected]/repo" | ||
} | ||
|
||
exports['git-api subject and body gets subject and body 1'] = { | ||
"subject": "commit does this", | ||
"body": "more details" | ||
"remote": "[email protected]/repo", | ||
"timestamp": "123" | ||
} |
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 |
---|---|---|
|
@@ -73,6 +73,7 @@ describe('commit-info', () => { | |
stubSpawnShellOnce(gitCommands.email, 0, '[email protected]', '') | ||
stubSpawnShellOnce(gitCommands.author, 0, 'John Doe', '') | ||
stubSpawnShellOnce(gitCommands.sha, 0, 'abc123', '') | ||
stubSpawnShellOnce(gitCommands.timestamp, 0, '123', '') | ||
stubSpawnShellOnce( | ||
gitCommands.remoteOriginUrl, | ||
0, | ||
|
@@ -89,6 +90,7 @@ describe('commit-info', () => { | |
stubSpawnShellOnce(gitCommands.author, 1, '', 'missing author') | ||
stubSpawnShellOnce(gitCommands.sha, 0, 'abc123', '') | ||
stubSpawnShellOnce(gitCommands.remoteOriginUrl, 1, '', 'no remote origin') | ||
stubSpawnShellOnce(gitCommands.timestamp, 0, '123', '') | ||
return commitInfo() | ||
.tap(info => { | ||
la(info.message === null, 'message should be null', info) | ||
|
@@ -137,6 +139,7 @@ describe('commit-info', () => { | |
stubSpawnShellOnce(gitCommands.email, 1, '', 'could not get Git email') | ||
stubSpawnShellOnce(gitCommands.author, 0, 'John Doe', '') | ||
stubSpawnShellOnce(gitCommands.sha, 0, 'abc123', '') | ||
stubSpawnShellOnce(gitCommands.timestamp, 0, '123', '') | ||
stubSpawnShellOnce( | ||
gitCommands.remoteOriginUrl, | ||
0, | ||
|
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 |
---|---|---|
|
@@ -85,14 +85,16 @@ describe('git-api', () => { | |
getEmail, | ||
getAuthor, | ||
getSha, | ||
getRemoteOrigin | ||
getRemoteOrigin, | ||
getTimestamp | ||
} = require('./git-api') | ||
|
||
it('works', () => { | ||
stubSpawnShellOnce(gitCommands.message, 0, 'important commit', '') | ||
stubSpawnShellOnce(gitCommands.email, 0, '[email protected]', '') | ||
stubSpawnShellOnce(gitCommands.author, 0, 'John Doe', '') | ||
stubSpawnShellOnce(gitCommands.sha, 0, 'abc123', '') | ||
stubSpawnShellOnce(gitCommands.timestamp, 0, '123', '') | ||
stubSpawnShellOnce( | ||
gitCommands.remoteOriginUrl, | ||
0, | ||
|
@@ -105,7 +107,8 @@ describe('git-api', () => { | |
email: getEmail(), | ||
author: getAuthor(), | ||
sha: getSha(), | ||
remote: getRemoteOrigin() | ||
remote: getRemoteOrigin(), | ||
timestamp: getTimestamp() | ||
}).then(snapshot) | ||
}) | ||
}) | ||
|
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
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
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