ark-member/internal/logic/generate_refresh_code_logic...

52 lines
796 B
Go
Raw Normal View History

2024-08-02 02:10:25 +00:00
package logic
import (
"testing"
"github.com/stretchr/testify/assert"
)
func Test_getCodeNameByCode(t *testing.T) {
type args struct {
code int32
}
tests := []struct {
name string
args args
want string
want1 bool
}{
{
name: "email",
args: args{
code: 1,
},
want: "email",
want1: true,
},
{
name: "phone",
args: args{
code: 2,
},
want: "phone",
want1: true,
},
{
name: "none",
args: args{
code: 3,
},
want: "",
want1: false,
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
got, got1 := getCodeNameByCode(tt.args.code)
assert.Equalf(t, tt.want, got, "getCodeNameByCode(%v)", tt.args.code)
assert.Equalf(t, tt.want1, got1, "getCodeNameByCode(%v)", tt.args.code)
})
}
}