From d6e52e1363cdac3a2792608467b1f3f8449abb31 Mon Sep 17 00:00:00 2001 From: Vsevolod Kaloshin Date: Fri, 22 Dec 2023 12:40:19 +0100 Subject: [PATCH] add unit tests for IsEntityNotExistsError (#5528) --- common/util_test.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/common/util_test.go b/common/util_test.go index 913da29a927..e4ec71e7744 100644 --- a/common/util_test.go +++ b/common/util_test.go @@ -478,3 +478,15 @@ func TestIsValidIDLength(t *testing.T) { logger.AssertExpectations(t) }) } + +func TestIsEntityNotExistsError(t *testing.T) { + t.Run("is entity not exists error", func(t *testing.T) { + err := &types.EntityNotExistsError{} + require.True(t, IsEntityNotExistsError(err), "expected true, because err is entity not exists error") + }) + + t.Run("is not entity not exists error", func(t *testing.T) { + err := fmt.Errorf("generic error") + require.False(t, IsEntityNotExistsError(err), "expected false, because err is a generic error") + }) +}