package config

import "testing"

func TestLoadConfigsKeepActivityServiceAddr(t *testing.T) {
	tests := []struct {
		name string
		path string
		want string
	}{
		{name: "local", path: "../../configs/config.yaml", want: "127.0.0.1:13006"},
		{name: "docker", path: "../../configs/config.docker.yaml", want: "activity-service:13006"},
		{name: "tencent", path: "../../configs/config.tencent.example.yaml", want: "10.2.1.16:13006"},
	}

	for _, tt := range tests {
		t.Run(tt.name, func(t *testing.T) {
			cfg, err := Load(tt.path)
			if err != nil {
				t.Fatalf("Load %s config failed: %v", tt.name, err)
			}
			if cfg.ActivityServiceAddr != tt.want {
				t.Fatalf("activity service addr mismatch: got %q want %q", cfg.ActivityServiceAddr, tt.want)
			}
		})
	}
}
