goshort/internal/errs/errors_test.go
Gustavo Maronato be39b22ace
Some checks failed
Check / checks (push) Failing after 3m48s
lint
2024-03-09 05:53:28 -05:00

19 lines
567 B
Go

package errs_test
import (
"errors"
"testing"
"git.maronato.dev/maronato/goshort/internal/errs"
"github.com/stretchr/testify/assert"
)
func TestErrorf(t *testing.T) {
ErrMyError := errors.New("my error") //nolint:goerr113 // This is a test error
err := errs.Errorf("my message", ErrMyError)
assert.ErrorIs(t, err, ErrMyError, "Errorf should return an error with the same error type as the one passed as argument")
assert.Equal(t, "my message: my error", err.Error(), "Errorf should return an error with the same message as the one passed as argument")
}