100 lines
2.1 KiB
Go

package alt_advancement
import (
"testing"
"time"
)
func TestPackageBuild(t *testing.T) {
// Basic test to verify the package builds
config := AAManagerConfig{
UpdateInterval: time.Second * 30,
SaveInterval: time.Minute * 5,
AutoSave: true,
}
manager := NewAAManager(config)
if manager == nil {
t.Fatal("NewAAManager returned nil")
}
}
func TestAAManagerBasics(t *testing.T) {
config := AAManagerConfig{
UpdateInterval: time.Second * 30,
SaveInterval: time.Minute * 5,
AutoSave: true,
}
manager := NewAAManager(config)
// Test configuration
currentConfig := manager.GetConfig()
if currentConfig.UpdateInterval != config.UpdateInterval {
t.Error("Expected config to match")
}
// Test stats
stats := manager.GetSystemStats()
if stats == nil {
t.Error("Expected valid stats")
}
}
func TestMasterAAList(t *testing.T) {
masterList := NewMasterAAList()
if masterList == nil {
t.Fatal("NewMasterAAList returned nil")
}
// Test size with empty list
if masterList.Size() != 0 {
t.Error("Expected empty list to have size 0")
}
}
func TestMasterAANodeList(t *testing.T) {
nodeList := NewMasterAANodeList()
if nodeList == nil {
t.Fatal("NewMasterAANodeList returned nil")
}
// Test size with empty list
if nodeList.Size() != 0 {
t.Error("Expected empty node list to have size 0")
}
}
func TestAATemplate(t *testing.T) {
template := NewAATemplate(1, "Test Template")
if template == nil {
t.Fatal("NewAATemplate returned nil")
}
if template.TemplateID != 1 {
t.Error("Expected template ID to be 1")
}
if template.Name != "Test Template" {
t.Error("Expected template name to be 'Test Template'")
}
}
func TestAAPlayerState(t *testing.T) {
playerState := NewAAPlayerState(123)
if playerState == nil {
t.Fatal("NewAAPlayerState returned nil")
}
if playerState.CharacterID != 123 {
t.Error("Expected character ID to be 123")
}
if playerState.AAProgress == nil {
t.Error("Expected AAProgress to be initialized")
}
if playerState.Templates == nil {
t.Error("Expected Templates to be initialized")
}
}