From fb3d36f3b6c74b862b95e35b85c6fe2c44bf70aa Mon Sep 17 00:00:00 2001 From: thedae Date: Tue, 14 Jan 2025 21:27:02 +0100 Subject: [PATCH] Fix tests Signed-off-by: thedae --- proxy/register_test.go | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/proxy/register_test.go b/proxy/register_test.go index c3a85e165..0f1f3972f 100644 --- a/proxy/register_test.go +++ b/proxy/register_test.go @@ -3,6 +3,7 @@ package proxy import ( + "reflect" "testing" ) @@ -52,10 +53,14 @@ func TestNewRegister_responseCombiner_fallbackIfErrored(t *testing.T) { original := &Response{IsComplete: true, Data: map[string]interface{}{"a": 42}} - result := rc(0, []*Response{original}) + result := rc(1, []*Response{{Data: original.Data, IsComplete: original.IsComplete}}) - if result != original { - t.Error("unexpected result:", result) + if !reflect.DeepEqual(original.Data, result.Data) { + t.Errorf("unexpected data, want=%+v | have=%+v", original.Data, result.Data) + return + } + if result.IsComplete != original.IsComplete { + t.Errorf("unexpected complete flag, want=%+v | have=%+v", original.IsComplete, result.IsComplete) return } } @@ -71,10 +76,14 @@ func TestNewRegister_responseCombiner_fallbackIfUnknown(t *testing.T) { original := &Response{IsComplete: true, Data: map[string]interface{}{"a": 42}} - result := rc(0, []*Response{original}) + result := rc(1, []*Response{{Data: original.Data, IsComplete: original.IsComplete}}) - if result != original { - t.Error("unexpected result:", result) + if !reflect.DeepEqual(original.Data, result.Data) { + t.Errorf("unexpected data, want=%+v | have=%+v", original.Data, result.Data) + return + } + if result.IsComplete != original.IsComplete { + t.Errorf("unexpected complete flag, want=%+v | have=%+v", original.IsComplete, result.IsComplete) return } }