From 2efd1f682d3eeeb79fb15261066f6d908cf35a21 Mon Sep 17 00:00:00 2001 From: Herman Slatman Date: Mon, 15 Jan 2024 16:31:00 +0100 Subject: [PATCH] Fix expected error type check --- acme/db/nosql/wire_test.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/acme/db/nosql/wire_test.go b/acme/db/nosql/wire_test.go index d2f592e5..1f820fa5 100644 --- a/acme/db/nosql/wire_test.go +++ b/acme/db/nosql/wire_test.go @@ -108,7 +108,8 @@ func TestDB_GetDpopToken(t *testing.T) { assert.EqualError(t, err, tc.expectedErr.Error()) ae := &acme.Error{} if errors.As(err, &ae) { - ee, _ := tc.expectedErr.(*acme.Error) + ee := &acme.Error{} + require.True(t, errors.As(tc.expectedErr, &ee)) assert.Equal(t, ee.Detail, ae.Detail) assert.Equal(t, ee.Type, ae.Type) assert.Equal(t, ee.Status, ae.Status) @@ -296,7 +297,8 @@ func TestDB_GetOidcToken(t *testing.T) { assert.EqualError(t, err, tc.expectedErr.Error()) ae := &acme.Error{} if errors.As(err, &ae) { - ee, _ := tc.expectedErr.(*acme.Error) + ee := &acme.Error{} + require.True(t, errors.As(tc.expectedErr, &ee)) assert.Equal(t, ee.Detail, ae.Detail) assert.Equal(t, ee.Type, ae.Type) assert.Equal(t, ee.Status, ae.Status)