main

mattermost/focalboard

Last updated at: 29/12/2023 09:40

app_test.go

TLDR

This file contains a test function TestSetConfig that tests the SetConfig method of the App struct.

Methods

TestSetConfig

This method is a unit test for the SetConfig method. It sets up a test environment, calls the SetConfig method with a new configuration, and then checks if the EnablePublicSharedBoards field of the App struct is updated correctly.

package app

import (
	"testing"

	"github.com/mattermost/focalboard/server/services/config"
	"github.com/stretchr/testify/require"
)

func TestSetConfig(t *testing.T) {
	th, tearDown := SetupTestHelper(t)
	defer tearDown()

	t.Run("Test Update Config", func(t *testing.T) {
		require.False(t, th.App.config.EnablePublicSharedBoards)
		newConfiguration := config.Configuration{}
		newConfiguration.EnablePublicSharedBoards = true
		th.App.SetConfig(&newConfiguration)

		require.True(t, th.App.config.EnablePublicSharedBoards)
	})
}