Skip to content

Commit

Permalink
Merge pull request #53 from cksource/t/47
Browse files Browse the repository at this point in the history
Other: Shortened hashes to 7-char version in the `save-hashes` command. Closes #47.
  • Loading branch information
Reinmar committed Jul 4, 2017
2 parents 5751eb7 + 335b392 commit 73990c8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion lib/commands/savehashes.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ module.exports = {

const commandResponse = {
packageName: data.packageName,
commit: commitHash
commit: commitHash.slice( 0, 7 ) // Short version of the commit hash.
};

log.info( `Commit: "${ commitHash }".` );
Expand Down
14 changes: 7 additions & 7 deletions tests/commands/savehashes.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ describe( 'commands/savehashes', () => {
it( 'resolves promise with last commit id', () => {
const execCommandResponse = {
logs: {
info: [ '584f34152d782cc2f26453e10b93c4a16ef01925' ]
info: [ '584f341' ]
}
};

Expand All @@ -90,10 +90,10 @@ describe( 'commands/savehashes', () => {

expect( commandResponse.response ).to.deep.equal( {
packageName: data.packageName,
commit: '584f34152d782cc2f26453e10b93c4a16ef01925'
commit: '584f341'
} );

expect( commandResponse.logs.info[ 0 ] ).to.equal( 'Commit: "584f34152d782cc2f26453e10b93c4a16ef01925".' );
expect( commandResponse.logs.info[ 0 ] ).to.equal( 'Commit: "584f341".' );
} );
} );
} );
Expand All @@ -108,11 +108,11 @@ describe( 'commands/savehashes', () => {

commandResponses.add( {
packageName: 'test-package',
commit: '584f34152d782cc2f26453e10b93c4a16ef01925'
commit: '584f341'
} );
commandResponses.add( {
packageName: 'package-test',
commit: '52910fe61a4c39b01e35462f2cc287d25143f485'
commit: '52910fe'
} );

saveHashesCommand.afterExecute( processedPackages, commandResponses );
Expand All @@ -131,8 +131,8 @@ describe( 'commands/savehashes', () => {
json = updateFunction( json );

expect( json.dependencies ).to.deep.equal( {
'test-package': 'organization/test-package#584f34152d782cc2f26453e10b93c4a16ef01925',
'package-test': 'organization/package-test#52910fe61a4c39b01e35462f2cc287d25143f485',
'test-package': 'organization/test-package#584f341',
'package-test': 'organization/package-test#52910fe',
'other-package': 'organization/other-package'
} );
} );
Expand Down

0 comments on commit 73990c8

Please sign in to comment.