refactor: remove unnecessary object destructuring

This commit is contained in:
Pierre Vanduynslager 2018-07-07 01:43:29 -04:00
parent 5989989452
commit 50061bb267
3 changed files with 8 additions and 15 deletions

View File

@ -35,10 +35,7 @@ module.exports = async ({repositoryUrl, branch}) => {
// Replace `git+https` and `git+http` with `https` or `http` // Replace `git+https` and `git+http` with `https` or `http`
if (protocols.includes('http') || protocols.includes('https')) { if (protocols.includes('http') || protocols.includes('https')) {
repositoryUrl = format({ repositoryUrl = format({...parse(repositoryUrl), protocol: protocols.includes('https') ? 'https' : 'http'});
...parse(repositoryUrl),
...{protocol: protocols.includes('https') ? 'https' : 'http'},
});
} }
} }

View File

@ -263,16 +263,16 @@ test.serial('Use new gitHead, and recreate release notes if a prepare plugin cre
t.is(generateNotes.callCount, 2); t.is(generateNotes.callCount, 2);
t.deepEqual(generateNotes.args[0][1].nextRelease, nextRelease); t.deepEqual(generateNotes.args[0][1].nextRelease, nextRelease);
t.is(prepare1.callCount, 1); t.is(prepare1.callCount, 1);
t.deepEqual(prepare1.args[0][1].nextRelease, {...nextRelease, ...{notes}}); t.deepEqual(prepare1.args[0][1].nextRelease, {...nextRelease, notes});
nextRelease.gitHead = await getGitHead(); nextRelease.gitHead = await getGitHead();
t.deepEqual(generateNotes.args[1][1].nextRelease, {...nextRelease, ...{notes}}); t.deepEqual(generateNotes.args[1][1].nextRelease, {...nextRelease, notes});
t.is(prepare2.callCount, 1); t.is(prepare2.callCount, 1);
t.deepEqual(prepare2.args[0][1].nextRelease, {...nextRelease, ...{notes}}); t.deepEqual(prepare2.args[0][1].nextRelease, {...nextRelease, notes});
t.is(publish.callCount, 1); t.is(publish.callCount, 1);
t.deepEqual(publish.args[0][1].nextRelease, {...nextRelease, ...{notes}}); t.deepEqual(publish.args[0][1].nextRelease, {...nextRelease, notes});
// Verify the tag has been created on the local and remote repo and reference the last gitHead // Verify the tag has been created on the local and remote repo and reference the last gitHead
t.is(await gitTagHead(nextRelease.gitTag), commits[0].hash); t.is(await gitTagHead(nextRelease.gitTag), commits[0].hash);
@ -321,14 +321,10 @@ test.serial('Call all "success" plugins even if one errors out', async t => {
t.is(success1.callCount, 1); t.is(success1.callCount, 1);
t.deepEqual(success1.args[0][0], config); t.deepEqual(success1.args[0][0], config);
t.deepEqual(success1.args[0][1].releases, [ t.deepEqual(success1.args[0][1].releases, [{...release, ...nextRelease, notes, pluginName: '[Function: proxy]'}]);
{...release, ...nextRelease, ...{notes}, ...{pluginName: '[Function: proxy]'}},
]);
t.is(success2.callCount, 1); t.is(success2.callCount, 1);
t.deepEqual(success2.args[0][1].releases, [ t.deepEqual(success2.args[0][1].releases, [{...release, ...nextRelease, notes, pluginName: '[Function: proxy]'}]);
{...release, ...nextRelease, ...{notes}, ...{pluginName: '[Function: proxy]'}},
]);
}); });
test.serial('Log all "verifyConditions" errors', async t => { test.serial('Log all "verifyConditions" errors', async t => {

View File

@ -614,7 +614,7 @@ test.serial('Exit with 1 if missing permission to push to the remote repository'
const {stdout, code} = await execa( const {stdout, code} = await execa(
cli, cli,
['--repository-url', 'http://user:wrong_pass@localhost:2080/git/unauthorized.git'], ['--repository-url', 'http://user:wrong_pass@localhost:2080/git/unauthorized.git'],
{env: {...env, ...{GH_TOKEN: 'user:wrong_pass'}}, reject: false} {env: {...env, GH_TOKEN: 'user:wrong_pass'}, reject: false}
); );
// Verify the type and message are logged // Verify the type and message are logged
t.regex(stdout, /EGITNOPERMISSION/); t.regex(stdout, /EGITNOPERMISSION/);