mirror of
https://github.com/status-im/status-go.git
synced 2025-01-10 14:47:06 +00:00
9a59d6a459
This commit adds support for centralized metrics. There are two providers as of now, and we haven't quite decided which one to go for, so for the time being both are supported. It also introduces a new endpoint InitializeApplication that replaces OpenAccounts
37 lines
752 B
Go
37 lines
752 B
Go
package requests
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/require"
|
|
|
|
"github.com/status-im/status-go/centralizedmetrics/common"
|
|
)
|
|
|
|
func TestValidateAddCentralizedMetrics(t *testing.T) {
|
|
tests := []struct {
|
|
name string
|
|
request AddCentralizedMetric
|
|
expectedError error
|
|
}{
|
|
{
|
|
name: "valid metric",
|
|
request: AddCentralizedMetric{
|
|
Metric: &common.Metric{EventName: "event-name", Platform: "android", AppVersion: "version"},
|
|
},
|
|
expectedError: nil,
|
|
},
|
|
{
|
|
name: "empty metric",
|
|
expectedError: ErrAddCentralizedMetricInvalidMetric,
|
|
},
|
|
}
|
|
|
|
for _, tt := range tests {
|
|
t.Run(tt.name, func(t *testing.T) {
|
|
err := tt.request.Validate()
|
|
require.Equal(t, tt.expectedError, err)
|
|
})
|
|
}
|
|
}
|