fadd
This commit is contained in:
@@ -0,0 +1,51 @@
|
||||
package certification
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestIsEnterpriseAlreadyAuthorizedErr(t *testing.T) {
|
||||
cases := []struct {
|
||||
name string
|
||||
err error
|
||||
want bool
|
||||
}{
|
||||
{
|
||||
name: "fadada 210002",
|
||||
err: errors.New("获取法大大企业认证链接失败: code=210002 msg=该企业已授权,无需重复操作 requestId=abc"),
|
||||
want: true,
|
||||
},
|
||||
{
|
||||
name: "exist authorize wording",
|
||||
err: errors.New("当前应用已存在授权"),
|
||||
want: true,
|
||||
},
|
||||
{
|
||||
name: "other error",
|
||||
err: errors.New("获取法大大企业认证链接失败: code=100011 msg=参数错误"),
|
||||
want: false,
|
||||
},
|
||||
{
|
||||
name: "nil",
|
||||
err: nil,
|
||||
want: false,
|
||||
},
|
||||
}
|
||||
for _, tc := range cases {
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
if got := isEnterpriseAlreadyAuthorizedErr(tc.err); got != tc.want {
|
||||
t.Fatalf("got %v want %v", got, tc.want)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestIsEnterpriseAlreadyRealnamedErr(t *testing.T) {
|
||||
if !isEnterpriseAlreadyRealnamedErr(errors.New("企业用户已实名")) {
|
||||
t.Fatal("expected true for 已实名")
|
||||
}
|
||||
if isEnterpriseAlreadyRealnamedErr(errors.New("该企业已授权,无需重复操作")) {
|
||||
t.Fatal("已授权 should not match 已实名 helper")
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user