From 32aed04fb051a1a169bad45a2c7df0201cf087cb Mon Sep 17 00:00:00 2001 From: Dimitris Date: Wed, 20 Dec 2023 17:56:35 +0200 Subject: [PATCH] Add WrapIfError test --- pkg/utils/utils_test.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/pkg/utils/utils_test.go b/pkg/utils/utils_test.go index 346cfab47..93601638a 100644 --- a/pkg/utils/utils_test.go +++ b/pkg/utils/utils_test.go @@ -1,15 +1,27 @@ package utils_test import ( + "errors" "sync" "testing" "time" + "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "github.com/smartcontractkit/chainlink-common/pkg/utils" ) +func TestWrapIfError(t *testing.T) { + t.Parallel() + + t.Run("wraps error", func(t *testing.T) { + err := errors.New("this is an error") + utils.WrapIfError(&err, "wrapped message") + assert.Equal(t, "wrapped message: this is an error", err.Error()) + }) +} + func TestAllEqual(t *testing.T) { t.Parallel()