1
0
mirror of https://github.com/mattermost/focalboard.git synced 2024-12-12 09:04:14 +02:00
focalboard/server/app/clientConfig_test.go
Scott Bishel 9b9682f626
Create FeatureFlags in configurations (#1622)
* create FeatureFlags in configurations

* update for unit tests

* update unit tests, go.mod

* update go.sum

* fix lint errors

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2021-11-01 19:12:43 -06:00

31 lines
929 B
Go

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
newConfiguration.FeatureFlags = make(map[string]string)
newConfiguration.FeatureFlags["BoardsFeature1"] = "true"
newConfiguration.FeatureFlags["BoardsFeature2"] = "true"
th.App.SetConfig(&newConfiguration)
clientConfig := th.App.GetClientConfig()
require.True(t, clientConfig.EnablePublicSharedBoards)
require.True(t, clientConfig.Telemetry)
require.Equal(t, "abcde", clientConfig.TelemetryID)
require.Equal(t, 2, len(clientConfig.FeatureFlags))
})
}