package config import "testing" func TestMongoURI(t *testing.T) { cfg := Config{ MongoHost: "127.0.0.1", MongoPort: 27017, MongoUsername: "user", MongoPassword: "pass", MongoAuthSource: "admin", BusinessMongoDatabase: "openim_v3", SchedulerMongoDatabase: "scheduler_center", } got := cfg.MongoURI() want := "mongodb://user:pass@127.0.0.1:27017/?authSource=admin" if got != want { t.Fatalf("MongoURI() = %q, want %q", got, want) } }