mirror of
https://github.com/zitadel/zitadel.git
synced 2024-12-12 19:14:23 +00:00
191690d905
* sdk * fix(sdk): return correct error type * AppendEventError instead of Aggregater error * fix(tests): tests * fix(tests): wantErr to is error func
32 lines
611 B
Go
32 lines
611 B
Go
package sdk
|
|
|
|
import (
|
|
"errors"
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
func TestAppendEventError(t *testing.T) {
|
|
var err interface{}
|
|
err = new(appendEventError)
|
|
_, ok := err.(*appendEventError)
|
|
assert.True(t, ok)
|
|
}
|
|
|
|
func TestThrowAppendEventErrorf(t *testing.T) {
|
|
err := ThrowAggregaterf(nil, "id", "msg")
|
|
_, ok := err.(*appendEventError)
|
|
assert.True(t, ok)
|
|
}
|
|
|
|
func TestIsAppendEventError(t *testing.T) {
|
|
err := ThrowAppendEventError(nil, "id", "msg")
|
|
ok := IsAppendEventError(err)
|
|
assert.True(t, ok)
|
|
|
|
err = errors.New("i am found")
|
|
ok = IsAppendEventError(err)
|
|
assert.False(t, ok)
|
|
}
|