From 7c3b24c63a13162282d5408cf92a2dc3ef7f3f88 Mon Sep 17 00:00:00 2001 From: Pierre Vanduynslager Date: Mon, 14 Oct 2019 16:03:06 -0400 Subject: [PATCH] fix: set `shortHash` to commit object --- lib/commit-transform.js | 2 +- test/commit-transform.test.js | 2 +- test/preset.test.js | 3 +-- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/lib/commit-transform.js b/lib/commit-transform.js index d64ff10..0375260 100644 --- a/lib/commit-transform.js +++ b/lib/commit-transform.js @@ -31,7 +31,7 @@ module.exports = (commit, context) => { } if (typeof commit.hash === 'string') { - commit.hash = commit.hash.substring(0, COMMIT_HASH_LENGTH); + commit.shortHash = commit.hash.substring(0, COMMIT_HASH_LENGTH); } const references = []; diff --git a/test/commit-transform.test.js b/test/commit-transform.test.js index 797a3c8..5dc2798 100644 --- a/test/commit-transform.test.js +++ b/test/commit-transform.test.js @@ -15,7 +15,7 @@ test('Return transformed commit and truncate hash', t => { t.is(commit.type, 'feat'); t.is(commit.groupType, 'Feature title'); - t.is(commit.hash.length, COMMIT_HASH_LENGTH); + t.is(commit.shortHash.length, COMMIT_HASH_LENGTH); t.true('1234567890'.startsWith(commit.hash)); }); diff --git a/test/preset.test.js b/test/preset.test.js index 8590fa7..9e57aee 100644 --- a/test/preset.test.js +++ b/test/preset.test.js @@ -57,10 +57,9 @@ test.serial('Create commit link', async t => { {types: {fix: {title: 'Fix title', changelog: true}}}, {pkg: {path: path.join(__dirname, '/fixtures/_package.json')}} ); - const [, hash, url] = /\(\[(.*?)\]\((.*?)\)\)/.exec(log); + const [, hash] = /\(\[(.*?)\]\(.*?\)\)/.exec(log); t.is(hash.length, COMMIT_HASH_LENGTH); - t.is(url, `https://github.com/github_user/repo_name/commit/${hash}`); }); test.serial('Create reference link', async t => {