Skip to content
This repository has been archived by the owner on Jun 28, 2022. It is now read-only.

Commit

Permalink
runat-1128988: Mock 'document' better (Part 2)
Browse files Browse the repository at this point in the history
For the remote case, we're calling "mocks on" on the server, but we
still need to register the mockCommand converters on the client.

Signed-off-by: Joe Walker <[email protected]>
  • Loading branch information
joewalker committed Mar 5, 2015
1 parent b5d2952 commit e289f80
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions lib/gcli/test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ var KeyEvent = require('../util/util').KeyEvent;

var test = require('../commands/test');
var helpers = require('./helpers');
var mockCommands = require('./mockCommands');
var createTerminalAutomator = require('./automators/terminal').createTerminalAutomator;
require('./suite');

Expand Down Expand Up @@ -124,6 +125,20 @@ exports.run = function(terminal, isRemote) {
function setMocks(options, state) {
var command = 'mocks ' + (state ? 'on' : 'off');
return options.requisition.updateExec(command).then(function(data) {
// We're calling "mocks on" on the server, but we still need to
// register the mockCommand converters on the client
var requiredConverters = mockCommands.items.filter(function(item) {
return item.item === 'converter';
});

if (state) {
options.requisition.system.addItems(requiredConverters);
}
else {
options.requisition.system.removeItems(requiredConverters);

}

if (data.error) {
throw new Error('Failed to toggle mocks');
}
Expand Down

1 comment on commit e289f80

@bgrins
Copy link

@bgrins bgrins commented on e289f80 Mar 13, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

r+

Please sign in to comment.