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

Commit

Permalink
runat-1128988: mockCommands added json converters that we added to basic
Browse files Browse the repository at this point in the history
I'm not clear why we thought that being able to display json was only
something you'd want to do during testing, but since we later added them
to the default set of converters, we don't need duplicates in test code.

Signed-off-by: Joe Walker <[email protected]>
  • Loading branch information
joewalker committed Mar 5, 2015
1 parent 08be168 commit 345fdda
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 14 deletions.
9 changes: 6 additions & 3 deletions lib/gcli/converters/basic.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,12 @@ exports.items = [
{
item: 'converter',
from: 'json',
to: 'dom',

This comment has been minimized.

Copy link
@bgrins

bgrins Mar 13, 2015

I'm assuming you meant to get rid of the from: 'json' / to: 'dom' converter here?

exec: function(json, conversionContext) {
return nodeFromDataToString(JSON.stringify(json), conversionContext);
to: 'view',
exec: function(json, context) {
var html = JSON.stringify(json, null, '&#160;').replace(/\n/g, '<br/>');
return {
html: '<pre>' + html + '</pre>'
};
}
},
{
Expand Down
11 changes: 0 additions & 11 deletions lib/gcli/test/mockCommands.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,21 +45,10 @@ function createExec(name) {
mockCommands.items = [
{
item: 'converter',
from: 'json',

This comment has been minimized.

Copy link
@bgrins

bgrins Mar 13, 2015

Why does the test need two commands at the start of the array that are just { item: 'converter' }?

This comment has been minimized.

Copy link
@bgrins

bgrins Mar 13, 2015

Oh, I see - more is added in 9895376

This comment has been minimized.

Copy link
@joewalker

joewalker Mar 13, 2015

Author Owner

Hmm. That's not what it looks like in my working tree. https://github.com/joewalker/gcli/blob/pr77-tip/lib/gcli/test/mockCommands.js
Something funny must have happened with a rebase. The contents are added back in again here: 9895376

to: 'string',
exec: function(json, context) {
return JSON.stringify(json, null, ' ');
}
},
{
item: 'converter',
from: 'json',
to: 'view',
exec: function(json, context) {
var html = JSON.stringify(json, null, '&#160;').replace(/\n/g, '<br/>');
return {
html: '<pre>' + html + '</pre>'
};
}
},
{
Expand Down

1 comment on commit 345fdda

@bgrins
Copy link

@bgrins bgrins commented on 345fdda 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.