Files
Erupe/server/entranceserver/entrance_server_test.go
Houmgaor dad6a23bba test: improve test coverage from 11% to 20%
Add comprehensive tests across multiple packages:

- mhfpacket: Add tests for 300+ packet opcodes, system packets,
  MHF packets, and detailed parsing tests (6.4% -> 38.8%)
- timeserver: Add tests for all time functions (0% -> 97.4%)
- deltacomp: Add edge case tests for compression functions
- entranceserver: Add server creation tests
- binpacket: Add mail notify panic test
- config: Add Mode.String() tests
- signserver: Expand server tests
2026-02-02 11:02:52 +01:00

63 lines
1.1 KiB
Go

package entranceserver
import (
"testing"
"erupe-ce/config"
)
func TestNewServer(t *testing.T) {
cfg := &Config{
Logger: nil,
DB: nil,
ErupeConfig: &config.Config{},
}
s := NewServer(cfg)
if s == nil {
t.Fatal("NewServer() returned nil")
}
if s.isShuttingDown {
t.Error("New server should not be shutting down")
}
if s.erupeConfig == nil {
t.Error("erupeConfig should not be nil")
}
}
func TestNewServerWithNilConfig(t *testing.T) {
cfg := &Config{}
s := NewServer(cfg)
if s == nil {
t.Fatal("NewServer() returned nil for empty config")
}
}
func TestServerType(t *testing.T) {
s := &Server{}
if s.isShuttingDown {
t.Error("Zero value server should not be shutting down")
}
if s.listener != nil {
t.Error("Zero value server should have nil listener")
}
}
func TestConfigFields(t *testing.T) {
cfg := &Config{
Logger: nil,
DB: nil,
ErupeConfig: nil,
}
if cfg.Logger != nil {
t.Error("Config Logger should be nil")
}
if cfg.DB != nil {
t.Error("Config DB should be nil")
}
if cfg.ErupeConfig != nil {
t.Error("Config ErupeConfig should be nil")
}
}