mirror of
https://github.com/zitadel/zitadel.git
synced 2025-12-10 21:02:21 +00:00
28 lines
665 B
Go
28 lines
665 B
Go
package instance
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
"github.com/zitadel/zitadel/internal/zerrors"
|
|
)
|
|
|
|
func TestValidateParam(t *testing.T) {
|
|
tt := []struct {
|
|
param string
|
|
paramName string
|
|
expectedErr error
|
|
}{
|
|
{"", "instance_id", zerrors.ThrowInvalidArgument(nil, "instance_id", "instance_id must not be empty")},
|
|
{" ", "instance_id", zerrors.ThrowInvalidArgument(nil, "instance_id", "instance_id must not be empty")},
|
|
{"valid_id", "instance_id", nil},
|
|
}
|
|
|
|
for _, tc := range tt {
|
|
t.Run(tc.param, func(t *testing.T) {
|
|
err := validateParam(tc.param, tc.paramName)
|
|
assert.Equal(t, tc.expectedErr, err)
|
|
})
|
|
}
|
|
}
|