Skip to content

Commit

Permalink
Update parseConsoleRemoteObjectValue
Browse files Browse the repository at this point in the history
This updates parseConsoleRemoteObjectValue to work with
parseConsoleRemoteArrayPreview which will parse an array.
  • Loading branch information
ankur22 committed Dec 15, 2023
1 parent f0c5d58 commit e522b1d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 3 additions & 0 deletions common/remote_object.go
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,9 @@ func parseConsoleRemoteObjectValue(
}
case cdpruntime.TypeObject:
if op != nil {
if st == "array" {
return parseConsoleRemoteArrayPreview(logger, op)
}
return parseConsoleRemoteObjectPreview(logger, op)
}
if val == "Object" {
Expand Down
4 changes: 2 additions & 2 deletions tests/remote_obj_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ func TestConsoleLogParse(t *testing.T) {
name: "bool", log: "true", want: "true",
},
{
name: "empty_array", log: "[]", want: "{}", // TODO: Improve this output
name: "empty_array", log: "[]", want: "[]",
},
{
name: "empty_object", log: "{}", want: "{}",
Expand All @@ -39,7 +39,7 @@ func TestConsoleLogParse(t *testing.T) {
name: "filled_object", log: `{"foo":{"bar1":"bar2"}}`, want: `{"foo":"Object"}`,
},
{
name: "filled_array", log: `["foo","bar"]`, want: `{"0":"foo","1":"bar"}`,
name: "filled_array", log: `["foo","bar"]`, want: `["foo","bar"]`,
},
{
name: "filled_array", log: `() => true`, want: `function()`,
Expand Down

0 comments on commit e522b1d

Please sign in to comment.