zitadel/internal/eventstore/handler/crdb/init_test.go
Tim Möhlmann 5819924275
feat: device authorization RFC 8628 (#5646)
* 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>
2023-04-19 08:46:02 +00:00

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"
}