1
1
mirror of https://github.com/OpenDiablo2/OpenDiablo2 synced 2025-02-13 12:06:31 -05:00
OpenDiablo2/d2core/d2systems/game_config_test.go

39 lines
922 B
Go
Raw Normal View History

2020-10-12 17:35:11 -04:00
package d2systems
import (
"testing"
"github.com/gravestench/akara"
)
func Test_GameConfigSystem_Bootstrap(t *testing.T) {
2020-11-22 16:18:50 -05:00
const testDataPath = "testdata"
2020-10-12 17:35:11 -04:00
cfg := akara.NewWorldConfig()
typeSys := &FileTypeResolver{}
handleSys := &FileHandleResolver{}
srcSys := &FileSourceResolver{}
cfgSys := &GameConfigSystem{}
2020-10-12 17:35:11 -04:00
cfg.With(typeSys).
With(srcSys).
With(handleSys).
With(cfgSys)
2020-10-12 17:35:11 -04:00
world := akara.NewWorld(cfg)
cfgSys.AddFilePath(world.NewEntity()).Path = testDataPath
cfgSys.AddFilePath(world.NewEntity()).Path = "config.json"
2020-10-12 17:35:11 -04:00
// 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.
2020-10-12 17:35:11 -04:00
_ = world.Update(0)
if len(cfgSys.gameConfigs.GetEntities()) < 1 {
2020-10-12 17:35:11 -04:00
t.Error("no game configs were loaded")
}
}