95f0fc0b7a
* every user has a right of a username and a display name and has the right to change it * System information page now shows information about database user count, char count, and database schema version * more maintenance lists * show the right values in columns and fields * move similar from inside of frontend component functions to utility js when used multiple times * display help on mouse over * add more than one believe to character * make char name editable with better char info in headline * GiT Gifttoleranz value not calculated correctly * Bump backend to 0.2.3, frontend to 0.2.2
68 lines
1.4 KiB
Go
68 lines
1.4 KiB
Go
package appsystem
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"bamort/database"
|
|
"bamort/testutils"
|
|
)
|
|
|
|
func TestGetVersion(t *testing.T) {
|
|
version := GetVersion()
|
|
if version == "" {
|
|
t.Error("Version should not be empty")
|
|
}
|
|
if version != Version {
|
|
t.Errorf("Expected version %s, got %s", Version, version)
|
|
}
|
|
}
|
|
|
|
/*
|
|
func TestGetGitCommit(t *testing.T) {
|
|
commit := GetGitCommit()
|
|
if commit == "" {
|
|
t.Error("GitCommit should not be empty")
|
|
}
|
|
// Should be either "unknown" or a valid git hash
|
|
if commit != "unknown" && len(commit) < 7 {
|
|
t.Errorf("Invalid git commit format: %s", commit)
|
|
}
|
|
}
|
|
*/
|
|
func TestGetInfo(t *testing.T) {
|
|
info := GetInfo()
|
|
|
|
if info.Version == "" {
|
|
t.Error("Info.Version should not be empty")
|
|
}
|
|
|
|
if info.GitCommit == "" {
|
|
t.Error("Info.GitCommit should not be empty")
|
|
}
|
|
|
|
if info.Version != Version {
|
|
t.Errorf("Expected info.Version %s, got %s", Version, info.Version)
|
|
}
|
|
}
|
|
|
|
func TestGetInfo2UsesDatabaseValues(t *testing.T) {
|
|
testutils.SetupTestEnvironment(t)
|
|
database.ResetTestDB()
|
|
t.Cleanup(database.ResetTestDB)
|
|
database.SetupTestDB()
|
|
|
|
info := GetInfo2()
|
|
|
|
if info.CharCount <= 0 {
|
|
t.Fatalf("expected character count from database, got %d", info.CharCount)
|
|
}
|
|
|
|
if info.UserCount <= 0 {
|
|
t.Fatalf("expected user count from database, got %d", info.UserCount)
|
|
}
|
|
|
|
if info.DbVersion == "" {
|
|
t.Fatalf("expected database schema version, got empty string")
|
|
}
|
|
}
|