From 12107004ebff0729d78d4f1e2aa0b9b32e73c76e Mon Sep 17 00:00:00 2001 From: ankur22 Date: Tue, 12 Dec 2023 11:50:38 +0000 Subject: [PATCH] Update parseConsoleRemoteObjectValue This updates parseConsoleRemoteObjectValue to work with parseConsoleRemoteArrayPreview which will parse an array. --- common/remote_object.go | 3 +++ tests/remote_obj_test.go | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/common/remote_object.go b/common/remote_object.go index c63dd1e03..a22873cc8 100644 --- a/common/remote_object.go +++ b/common/remote_object.go @@ -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" { diff --git a/tests/remote_obj_test.go b/tests/remote_obj_test.go index abbf20a0a..519544757 100644 --- a/tests/remote_obj_test.go +++ b/tests/remote_obj_test.go @@ -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: "{}", @@ -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()`,