@@ -0,0 +1,33 @@
|
||||
package mediaService
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"91porn-server/models/v/mediamod"
|
||||
|
||||
"go.mongodb.org/mongo-driver/bson/primitive"
|
||||
)
|
||||
|
||||
func TestNormalizeImportedTagClassification(t *testing.T) {
|
||||
dimension, dimensionType, kind := normalizeImportedTagClassification(5, "画面风格", 1, mediamod.RiFan)
|
||||
if dimension != "剧场" || dimensionType != 5 || kind != mediamod.Theater {
|
||||
t.Fatalf("drama classification = (%q, %d, %d), want (%q, %d, %d)", dimension, dimensionType, kind, "剧场", 5, mediamod.Theater)
|
||||
}
|
||||
|
||||
dimension, dimensionType, kind = normalizeImportedTagClassification(1, "画面风格", 1, mediamod.RiFan)
|
||||
if dimension != "画面风格" || dimensionType != 1 || kind != mediamod.RiFan {
|
||||
t.Fatalf("animation classification changed to (%q, %d, %d)", dimension, dimensionType, kind)
|
||||
}
|
||||
}
|
||||
|
||||
func TestPrepareImportedTagIDs(t *testing.T) {
|
||||
current := []primitive.ObjectID{primitive.NewObjectID()}
|
||||
if got := prepareImportedTagIDs(5, current); len(got) != 0 {
|
||||
t.Fatalf("drama retained %d existing tags, want 0", len(got))
|
||||
}
|
||||
|
||||
got := prepareImportedTagIDs(1, current)
|
||||
if len(got) != 1 || got[0] != current[0] {
|
||||
t.Fatalf("animation tags = %v, want %v", got, current)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user