package grpcli

import (
	"testing"

	commonv1 "github.com/tidbcloud/tidb-management-service/api/spec/global/common/v1"
	nextgenv1 "github.com/tidbcloud/tidb-management-service/api/spec/global/nextgen/v1"
	mgmt "github.com/tidbcloud/tidb-management-service/api/spec/tidb_mgmt_service/v1"
)

func TestGetClusterServicePlanEssentialV2(t *testing.T) {
	cluster := &mgmt.Cluster{
		DeployType: mgmt.DeployType_DEPLOY_TYPE_NEXTGEN,
		ClusterInfo: &mgmt.Cluster_NextGenCluster{
			NextGenCluster: &nextgenv1.Cluster{
				ServicePlan: commonv1.ServicePlan_Essential_V2,
			},
		},
	}

	if got := GetClusterServicePlan(cluster); got != "Essential_V2" {
		t.Fatalf("GetClusterServicePlan() = %q, want Essential_V2", got)
	}
}
