UNPKG

mavensmate

Version:

Core APIs that drive MavensMate IDEs for Salesforce1/Force.com

60 lines (48 loc) 1.63 kB
'use strict'; var assert = require('assert'); var sinon = require('sinon'); var sinonAsPromised = require('sinon-as-promised'); var util = require('../../../../app/lib/util'); var _ = require('lodash'); var helper = require('../../../test-helper'); var commandExecutor = require('../../../../app/lib/commands')(); sinonAsPromised(require('bluebird')); describe('mavensmate new-lightning-app-cli', function(){ var program; var commandExecutorStub; var getPayloadStub; before(function() { program = helper.initCli(); }); beforeEach(function() { commandExecutorStub = sinon.stub(program.commandExecutor, 'execute'); getPayloadStub = sinon.stub(util, 'getPayload').resolves({ foo : 'bar' }); }); afterEach(function() { commandExecutorStub.restore(); getPayloadStub.restore(); }); it('should accept a ui flag', function(done) { var cmd = _.find(program.commands, { _name : 'new-lightning-app' }); cmd.ui = true; program._events['new-lightning-app'](); commandExecutorStub.calledOnce.should.equal(true); assert(commandExecutorStub.calledWithMatch({ name: 'new-lightning-app', body: { args: { ui: true } } })); cmd.ui = false; done(); }); it('should accept stdin', function(done) { program._events['new-lightning-app'](); getPayloadStub().then(function() { commandExecutorStub.calledOnce.should.equal(true); assert(commandExecutorStub.calledWithMatch({ name: 'new-lightning-app', body: { foo : 'bar' } })); done(); }); }); });