2021-09-16 21:31:02 +02:00
|
|
|
package app
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
"github.com/mattermost/focalboard/server/services/config"
|
|
|
|
"github.com/stretchr/testify/require"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestGetClientConfig(t *testing.T) {
|
|
|
|
th, tearDown := SetupTestHelper(t)
|
|
|
|
defer tearDown()
|
|
|
|
|
|
|
|
t.Run("Test Get Client Config", func(t *testing.T) {
|
|
|
|
newConfiguration := config.Configuration{}
|
|
|
|
newConfiguration.Telemetry = true
|
|
|
|
newConfiguration.TelemetryID = "abcde"
|
|
|
|
newConfiguration.EnablePublicSharedBoards = true
|
2021-11-02 02:12:43 +01:00
|
|
|
newConfiguration.FeatureFlags = make(map[string]string)
|
|
|
|
newConfiguration.FeatureFlags["BoardsFeature1"] = "true"
|
|
|
|
newConfiguration.FeatureFlags["BoardsFeature2"] = "true"
|
2022-07-08 16:43:43 +02:00
|
|
|
newConfiguration.TeammateNameDisplay = "username"
|
2021-09-16 21:31:02 +02:00
|
|
|
th.App.SetConfig(&newConfiguration)
|
|
|
|
|
|
|
|
clientConfig := th.App.GetClientConfig()
|
|
|
|
require.True(t, clientConfig.EnablePublicSharedBoards)
|
|
|
|
require.True(t, clientConfig.Telemetry)
|
|
|
|
require.Equal(t, "abcde", clientConfig.TelemetryID)
|
2021-11-02 02:12:43 +01:00
|
|
|
require.Equal(t, 2, len(clientConfig.FeatureFlags))
|
2022-07-08 16:43:43 +02:00
|
|
|
require.Equal(t, "username", clientConfig.TeammateNameDisplay)
|
2021-09-16 21:31:02 +02:00
|
|
|
})
|
|
|
|
}
|