Skip to content

Commit

Permalink
refactor: remove unnecessary object destructuring
Browse files Browse the repository at this point in the history
  • Loading branch information
pvdlg committed Jul 10, 2018
1 parent 5989989 commit 50061bb
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 15 deletions.
5 changes: 1 addition & 4 deletions lib/get-git-auth-url.js
Expand Up @@ -35,10 +35,7 @@ module.exports = async ({repositoryUrl, branch}) => {

// Replace `git+https` and `git+http` with `https` or `http`
if (protocols.includes('http') || protocols.includes('https')) {
repositoryUrl = format({
...parse(repositoryUrl),
...{protocol: protocols.includes('https') ? 'https' : 'http'},
});
repositoryUrl = format({...parse(repositoryUrl), protocol: protocols.includes('https') ? 'https' : 'http'});
}
}

Expand Down
16 changes: 6 additions & 10 deletions test/index.test.js
Expand Up @@ -263,16 +263,16 @@ test.serial('Use new gitHead, and recreate release notes if a prepare plugin cre
t.is(generateNotes.callCount, 2);
t.deepEqual(generateNotes.args[0][1].nextRelease, nextRelease);
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();

t.deepEqual(generateNotes.args[1][1].nextRelease, {...nextRelease, ...{notes}});
t.deepEqual(generateNotes.args[1][1].nextRelease, {...nextRelease, notes});
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.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
t.is(await gitTagHead(nextRelease.gitTag), commits[0].hash);
Expand Down Expand Up @@ -321,14 +321,10 @@ test.serial('Call all "success" plugins even if one errors out', async t => {

t.is(success1.callCount, 1);
t.deepEqual(success1.args[0][0], config);
t.deepEqual(success1.args[0][1].releases, [
{...release, ...nextRelease, ...{notes}, ...{pluginName: '[Function: proxy]'}},
]);
t.deepEqual(success1.args[0][1].releases, [{...release, ...nextRelease, notes, pluginName: '[Function: proxy]'}]);

t.is(success2.callCount, 1);
t.deepEqual(success2.args[0][1].releases, [
{...release, ...nextRelease, ...{notes}, ...{pluginName: '[Function: proxy]'}},
]);
t.deepEqual(success2.args[0][1].releases, [{...release, ...nextRelease, notes, pluginName: '[Function: proxy]'}]);
});

test.serial('Log all "verifyConditions" errors', async t => {
Expand Down
2 changes: 1 addition & 1 deletion test/integration.test.js
Expand Up @@ -614,7 +614,7 @@ test.serial('Exit with 1 if missing permission to push to the remote repository'
const {stdout, code} = await execa(
cli,
['--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
t.regex(stdout, /EGITNOPERMISSION/);
Expand Down

0 comments on commit 50061bb

Please sign in to comment.