fix: match tag to tagFormat from the begining of the string

This commit is contained in:
Pierre Vanduynslager
2018-04-11 17:11:33 -04:00
parent a8a07b7d51
commit 31ad23125a
2 changed files with 15 additions and 1 deletions
+13
View File
@@ -62,6 +62,19 @@ test.serial('Get the highest tag in the history of the current branch', async t
t.deepEqual(result, {gitHead: commits[0].hash, gitTag: 'v2.0.0', version: '2.0.0'});
});
test.serial('Match the tag name from the begining of the string', async t => {
// Create a git repository, set the current working directory at the root of the repo
await gitRepo();
const commits = await gitCommits(['First']);
await gitTagVersion('prefix/v1.0.0');
await gitTagVersion('prefix/v2.0.0');
await gitTagVersion('other-prefix/v3.0.0');
const result = await getLastRelease(`prefix/v\${version}`, t.context.logger);
t.deepEqual(result, {gitHead: commits[0].hash, gitTag: 'prefix/v2.0.0', version: '2.0.0'});
});
test.serial('Return empty object if no valid tag is found', async t => {
// Create a git repository, set the current working directory at the root of the repo
await gitRepo();