Files
huangguo_server/models/v/vidmod/payment_guide_test.go
T
rootandClaude Opus 5 8679200f41 Initial commit
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-15 13:57:10 +08:00

32 lines
790 B
Go

package vidmod
import (
"reflect"
"testing"
"go.mongodb.org/mongo-driver/bson"
)
func TestLatestVIPContentFilter(t *testing.T) {
excluded := []string{"module-a", "module-b"}
got := latestVIPContentFilter(excluded)
want := bson.M{
"status": CheckPass,
"newsType": bson.M{"$in": []string{SP, SHORT}},
"coins": 0,
"freeArea": bson.M{"$ne": true},
"recoWeight": bson.M{"$ne": -1},
"mId": bson.M{"$nin": excluded},
}
if !reflect.DeepEqual(got, want) {
t.Fatalf("latestVIPContentFilter() = %#v, want %#v", got, want)
}
}
func TestLatestVIPContentFilterWithoutExcludedModules(t *testing.T) {
got := latestVIPContentFilter(nil)
if _, exists := got["mId"]; exists {
t.Fatalf("mId filter must be absent when no modules are excluded: %#v", got)
}
}