1
1
mirror of https://github.com/OpenDiablo2/OpenDiablo2 synced 2025-02-09 18:17:07 -05:00
OpenDiablo2/d2core/d2systems/game_config_test.go

39 lines
922 B
Go

package d2systems
import (
"testing"
"github.com/gravestench/akara"
)
func Test_GameConfigSystem_Bootstrap(t *testing.T) {
const testDataPath = "testdata"
cfg := akara.NewWorldConfig()
typeSys := &FileTypeResolver{}
handleSys := &FileHandleResolver{}
srcSys := &FileSourceResolver{}
cfgSys := &GameConfigSystem{}
cfg.With(typeSys).
With(srcSys).
With(handleSys).
With(cfgSys)
world := akara.NewWorld(cfg)
cfgSys.AddFilePath(world.NewEntity()).Path = testDataPath
cfgSys.AddFilePath(world.NewEntity()).Path = "config.json"
// at this point the world has initialized the baseSystems. when the world
// updates it should process the config dir to a source and then
// use the source to resolve a file handle, and finally the config file
// will get loaded by the config system.
_ = world.Update(0)
if len(cfgSys.gameConfigs.GetEntities()) < 1 {
t.Error("no game configs were loaded")
}
}