mirror of
https://github.com/zitadel/zitadel.git
synced 2025-08-12 06:07:33 +00:00
chore: move the go code into a subfolder
This commit is contained in:
51
apps/api/internal/domain/oidc_error_reason_test.go
Normal file
51
apps/api/internal/domain/oidc_error_reason_test.go
Normal file
@@ -0,0 +1,51 @@
|
||||
package domain
|
||||
|
||||
import (
|
||||
"io"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/zitadel/oidc/v3/pkg/oidc"
|
||||
|
||||
"github.com/zitadel/zitadel/internal/zerrors"
|
||||
)
|
||||
|
||||
func TestOIDCErrorReasonFromError(t *testing.T) {
|
||||
tests := []struct {
|
||||
name string
|
||||
err error
|
||||
want OIDCErrorReason
|
||||
}{
|
||||
{
|
||||
name: "invalid request",
|
||||
err: oidc.ErrInvalidRequest().WithDescription("foo"),
|
||||
want: OIDCErrorReasonInvalidRequest,
|
||||
},
|
||||
{
|
||||
name: "invalid grant",
|
||||
err: oidc.ErrInvalidGrant().WithDescription("foo"),
|
||||
want: OIDCErrorReasonInvalidGrant,
|
||||
},
|
||||
{
|
||||
name: "precondition failed",
|
||||
err: zerrors.ThrowPreconditionFailed(nil, "123", "bar"),
|
||||
want: OIDCErrorReasonAccessDenied,
|
||||
},
|
||||
{
|
||||
name: "internal",
|
||||
err: zerrors.ThrowInternal(nil, "123", "bar"),
|
||||
want: OIDCErrorReasonServerError,
|
||||
},
|
||||
{
|
||||
name: "unspecified",
|
||||
err: io.ErrClosedPipe,
|
||||
want: OIDCErrorReasonUnspecified,
|
||||
},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
got := OIDCErrorReasonFromError(tt.err)
|
||||
assert.Equal(t, tt.want, got)
|
||||
})
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user