zitadel/internal/zerrors/zerror_test.go

19 lines
453 B
Go
Raw Normal View History

package zerrors_test
2020-03-18 15:45:24 +01:00
import (
"testing"
"github.com/stretchr/testify/assert"
"github.com/zitadel/zitadel/internal/zerrors"
2020-03-18 15:45:24 +01:00
)
func TestErrorMethod(t *testing.T) {
err := zerrors.ThrowError(nil, "id", "msg")
2020-03-18 15:45:24 +01:00
expected := "ID=id Message=msg"
assert.Equal(t, expected, err.Error())
err = zerrors.ThrowError(err, "subID", "subMsg")
2020-03-18 15:45:24 +01:00
subExptected := "ID=subID Message=subMsg Parent=(ID=id Message=msg)"
assert.Equal(t, subExptected, err.Error())
}