mirror of
https://github.com/zitadel/zitadel.git
synced 2024-12-16 21:08:00 +00:00
5819924275
* device auth: implement the write events * add grant type device code * fix(init): check if default value implements stringer --------- Co-authored-by: adlerhurst <silvan.reusser@gmail.com>
50 lines
739 B
Go
50 lines
739 B
Go
package crdb
|
|
|
|
import "testing"
|
|
|
|
func Test_defaultValue(t *testing.T) {
|
|
type args struct {
|
|
value interface{}
|
|
}
|
|
tests := []struct {
|
|
name string
|
|
args args
|
|
want string
|
|
}{
|
|
{
|
|
name: "string",
|
|
args: args{
|
|
value: "asdf",
|
|
},
|
|
want: "'asdf'",
|
|
},
|
|
{
|
|
name: "primitive non string",
|
|
args: args{
|
|
value: 1,
|
|
},
|
|
want: "1",
|
|
},
|
|
{
|
|
name: "stringer",
|
|
args: args{
|
|
value: testStringer(0),
|
|
},
|
|
want: "0",
|
|
},
|
|
}
|
|
for _, tt := range tests {
|
|
t.Run(tt.name, func(t *testing.T) {
|
|
if got := defaultValue(tt.args.value); got != tt.want {
|
|
t.Errorf("defaultValue() = %v, want %v", got, tt.want)
|
|
}
|
|
})
|
|
}
|
|
}
|
|
|
|
type testStringer int
|
|
|
|
func (t testStringer) String() string {
|
|
return "0529958243"
|
|
}
|