Skip to content

Commit

Permalink
fix(deploy-command): allow project to be passed in as argument using …
Browse files Browse the repository at this point in the history
…--projectId or -p (#122)
  • Loading branch information
SteveBunlon authored Nov 26, 2020
1 parent 4c0328b commit 2e36d3c
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 16 deletions.
5 changes: 5 additions & 0 deletions src/commands/deploy.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,11 @@ DeployCommand.flags = {
char: 'f',
description: 'Skip deploy confirmation.',
}),
projectId: flags.string({
char: 'p',
description: 'The id of the project you want to deploy.',
default: null,
}),
};

DeployCommand.args = [{
Expand Down
52 changes: 36 additions & 16 deletions test/commands/deploy.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,22 +58,42 @@ describe('deploy', () => {
});

describe('when project was provided', () => {
const projectId = 82;
const environmentName = 'name1';
it('should not display the list of projects', () => testCli({
env: testEnv2,
token: 'any',
command: () => DeployCommand.run([]),
api: [
getProjectByEnv(),
getEnvironmentListValid(projectId),
deployValid(),
],
std: [
...inOutSelectEnvironment(environmentName),
...inOutConfirmDeploy(environmentName),
],
}));
describe('using command line', () => {
const projectId = 82;
const environmentName = 'name1';
it('should not display the list of projects', () => testCli({
env: testEnv2,
token: 'any',
command: () => DeployCommand.run(['-p', '82']),
api: [
getEnvironmentListValid(projectId),
deployValid(),
],
std: [
...inOutSelectEnvironment(environmentName),
...inOutConfirmDeploy(environmentName),
],
}));
});

describe('guessed from FOREST_ENV_SECRET', () => {
const projectId = 82;
const environmentName = 'name1';
it('should not display the list of projects', () => testCli({
env: testEnv2,
token: 'any',
command: () => DeployCommand.run([]),
api: [
getProjectByEnv(),
getEnvironmentListValid(projectId),
deployValid(),
],
std: [
...inOutSelectEnvironment(environmentName),
...inOutConfirmDeploy(environmentName),
],
}));
});
});

describe('when destination environment was provided', () => {
Expand Down

0 comments on commit 2e36d3c

Please sign in to comment.