2023-12-08 14:30:55 +00:00
|
|
|
package zerrors_test
|
2020-03-18 14:45:24 +00:00
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
"github.com/stretchr/testify/assert"
|
2024-04-03 10:43:43 +00:00
|
|
|
|
2023-12-08 14:30:55 +00:00
|
|
|
"github.com/zitadel/zitadel/internal/zerrors"
|
2020-03-18 14:45:24 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
func TestErrorMethod(t *testing.T) {
|
2023-12-08 14:30:55 +00:00
|
|
|
err := zerrors.ThrowError(nil, "id", "msg")
|
2020-03-18 14:45:24 +00:00
|
|
|
expected := "ID=id Message=msg"
|
|
|
|
assert.Equal(t, expected, err.Error())
|
|
|
|
|
2023-12-08 14:30:55 +00:00
|
|
|
err = zerrors.ThrowError(err, "subID", "subMsg")
|
2020-03-18 14:45:24 +00:00
|
|
|
subExptected := "ID=subID Message=subMsg Parent=(ID=id Message=msg)"
|
|
|
|
assert.Equal(t, subExptected, err.Error())
|
|
|
|
}
|