27 lines
674 B
Go
27 lines
674 B
Go
package sysconfser
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"91porn-server/models/v/productmod"
|
|
|
|
"go.mongodb.org/mongo-driver/bson/primitive"
|
|
)
|
|
|
|
func TestShortDramaCardOptions(t *testing.T) {
|
|
first := primitive.NewObjectID()
|
|
second := primitive.NewObjectID()
|
|
products := []productmod.Product{
|
|
{ID: first, Name: "短剧月卡"},
|
|
{ID: second, Name: "短剧季卡"},
|
|
}
|
|
options := shortDramaCardOptions(products)
|
|
if len(options) != 2 {
|
|
t.Fatalf("options length = %d, want 2", len(options))
|
|
}
|
|
if options[0].Key != "短剧月卡" || options[0].Value != first.Hex() ||
|
|
options[1].Key != "短剧季卡" || options[1].Value != second.Hex() {
|
|
t.Fatalf("options = %#v", options)
|
|
}
|
|
}
|