Skip to content

Commit

Permalink
chore(consistancy): remove unnecessary assertions, update get-instanc…
Browse files Browse the repository at this point in the history
…e function name
  • Loading branch information
vikaspotluri123 committed Sep 5, 2018
1 parent fca4744 commit 593d851
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 10 deletions.
6 changes: 3 additions & 3 deletions lib/commands/start.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class StartCommand extends Command {

const start = () => Promise.resolve(processInstance.start(process.cwd(), this.system.environment))
.then(() => {
instance.running(this.system.environment);
instance.running(this.system.environment);
});

return this.ui.run(start, 'Starting Ghost', runOptions).then(() => {
Expand Down Expand Up @@ -89,8 +89,8 @@ class StartCommand extends Command {

StartCommand.global = true;
StartCommand.description = 'Start an instance of Ghost';
StartCommand.longDescription = '$0 start [name]\n Starts a known instance of Ghost'
StartCommand.params = '[name]'
StartCommand.longDescription = '$0 start [name]\n Starts a known instance of Ghost';
StartCommand.params = '[name]';
StartCommand.options = {
enable: {
description: '[--no-enable] Enable/don\'t enable the instance to restart on server reboot (if the process manager supports it)',
Expand Down
4 changes: 2 additions & 2 deletions lib/utils/get-instance.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
const checkValidInstall = require('./check-valid-install');
const {SystemError} = require('../errors');

function findInstance(instanceName, system, commandName) {
function getInstance(instanceName, system, commandName) {
const instance = system.getInstance(instanceName);

if (instanceName) {
Expand All @@ -19,4 +19,4 @@ function findInstance(instanceName, system, commandName) {
return instance;
}

module.exports = findInstance;
module.exports = getInstance;
2 changes: 1 addition & 1 deletion test/unit/commands/start-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ describe('Unit: Commands > Start', function () {
const stop = new StartCommand();

try {
stop.run({}).then(() => {throw new Error('Expected promise rejection')});
stop.run({});
expect(false, 'An error should have been thrown').to.be.true;
} catch (error) {
expect(error.message).to.equal('YES_IT_DOES');
Expand Down
5 changes: 2 additions & 3 deletions test/unit/commands/stop-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ describe('Unit: Commands > Stop', function () {
const stop = new StopCommand();

try {
stop.run({}).then(() => { throw new Error('Expected promise rejection') });
stop.run({});
expect(false, 'An error should have been thrown').to.be.true;
} catch (error) {
expect(error.message).to.equal('YES_IT_DOES');
Expand All @@ -50,7 +50,7 @@ describe('Unit: Commands > Stop', function () {

it('stops all if flag is provided', function () {
const stop = new StopCommand();
stop.stopAll = sinon.stub()
stop.stopAll = sinon.stub();
stop.run({all: true});
expect(stop.stopAll.calledOnce).to.be.true;
});
Expand Down Expand Up @@ -82,7 +82,6 @@ describe('Unit: Commands > Stop', function () {
myInstance.process = {stop: stopStub};
myInstance.running = sinon.stub().resolves(true);


return stop.run({});
});

Expand Down
2 changes: 1 addition & 1 deletion test/unit/utils/get-instance-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,4 @@ describe('Unit: Utils > getInstance', function () {
expect(stubs.chdir.calledOnce).to.to.true;
expect(stubs.chdir.calledWithExactly(dir)).to.be.true;
});
})
});

0 comments on commit 593d851

Please sign in to comment.