server_metadata_test.go
TLDR
This file contains a test function named TestGetServerMetadata
which tests the GetServerMetadata
method of the App
class.
Methods
TestGetServerMetadata
This test function sets up a test environment, calls the GetServerMetadata
method of the App
class, and checks if the returned metadata matches the expected values. The test ensures that the GetServerMetadata
method is working correctly.
Classes
App
The App
class is not defined in this file.
package app
import (
"reflect"
"runtime"
"testing"
"github.com/mattermost/focalboard/server/model"
)
func TestGetServerMetadata(t *testing.T) {
th, tearDown := SetupTestHelper(t)
defer tearDown()
th.Store.EXPECT().DBType().Return("TEST_DB_TYPE")
th.Store.EXPECT().DBVersion().Return("TEST_DB_VERSION")
t.Run("Get Server Metadata", func(t *testing.T) {
got := th.App.GetServerMetadata()
want := &ServerMetadata{
Version: model.CurrentVersion,
BuildNumber: model.BuildNumber,
BuildDate: model.BuildDate,
Commit: model.BuildHash,
Edition: model.Edition,
DBType: "TEST_DB_TYPE",
DBVersion: "TEST_DB_VERSION",
OSType: runtime.GOOS,
OSArch: runtime.GOARCH,
SKU: "personal_server",
}
if !reflect.DeepEqual(got, want) {
t.Errorf("got: %q, want: %q", got, want)
}
})
}