This commit is contained in:
@@ -1,33 +0,0 @@
|
||||
package subscribe
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
commonLogic "github.com/perfect-panel/server/internal/logic/common"
|
||||
"github.com/perfect-panel/server/internal/types"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
func TestFillUserSubscribeInfoEntitlementFields(t *testing.T) {
|
||||
sub := &types.UserSubscribeInfo{}
|
||||
entitlement := &commonLogic.EntitlementContext{
|
||||
EffectiveUserID: 3001,
|
||||
Source: commonLogic.EntitlementSourceFamilyOwner,
|
||||
OwnerUserID: 3001,
|
||||
ReadOnly: true,
|
||||
}
|
||||
|
||||
fillUserSubscribeInfoEntitlementFields(sub, entitlement)
|
||||
|
||||
require.Equal(t, commonLogic.EntitlementSourceFamilyOwner, sub.EntitlementSource)
|
||||
require.Equal(t, int64(3001), sub.EntitlementOwnerUserId)
|
||||
require.True(t, sub.ReadOnly)
|
||||
}
|
||||
|
||||
func TestNormalizeSubscribeNodeTags(t *testing.T) {
|
||||
tags := normalizeSubscribeNodeTags("美国, 日本, , 美国, ,日本")
|
||||
require.Equal(t, []string{"美国", "日本"}, tags)
|
||||
|
||||
empty := normalizeSubscribeNodeTags("")
|
||||
require.Nil(t, empty)
|
||||
}
|
||||
Reference in New Issue
Block a user