

+
|
diff --git a/src/TibiaWorldsWorld.go b/src/TibiaWorldsWorld.go index d6f52b66..ae6896f7 100644 --- a/src/TibiaWorldsWorld.go +++ b/src/TibiaWorldsWorld.go @@ -22,7 +22,7 @@ type World struct { Status string `json:"status"` // The current status of the world. PlayersOnline int `json:"players_online"` // The number of currently online players. RecordPlayers int `json:"record_players"` // The world's online players record. - RecordDate string `json:"record_date"` // The date when the record was achieved. + RecordDate string `json:"record_date,omitempty"` // The date when the record was achieved. CreationDate string `json:"creation_date"` // The year and month it was created. Location string `json:"location"` // The physical location of the servers. PvpType string `json:"pvp_type"` // The type of PvP. diff --git a/src/TibiaWorldsWorld_test.go b/src/TibiaWorldsWorld_test.go index 78681f8f..b0f6d50e 100644 --- a/src/TibiaWorldsWorld_test.go +++ b/src/TibiaWorldsWorld_test.go @@ -178,3 +178,41 @@ func TestWorldZuna(t *testing.T) { assert.Equal(20, firstPlayer.Level) assert.Equal("Paladin", firstPlayer.Vocation) } + +func TestWorldOceanis(t *testing.T) { + file, err := static.TestFiles.Open("testdata/worlds/world/Oceanis.html") + if err != nil { + t.Fatalf("file opening error: %s", err) + } + defer file.Close() + + data, err := io.ReadAll(file) + if err != nil { + t.Fatalf("File reading error: %s", err) + } + + worldJson, err := TibiaWorldsWorldImpl("Oceanis", string(data)) + if err != nil { + t.Fatal(err) + } + + assert := assert.New(t) + world := worldJson.World + + assert.Equal("Oceanis", world.Name) + assert.Equal("offline", world.Status) + assert.Equal(0, world.PlayersOnline) + assert.Equal(0, world.RecordPlayers) + assert.Empty(world.RecordDate) + assert.Equal("2024-04", world.CreationDate) + assert.Equal("Oceania", world.Location) + assert.Equal("Optional PvP", world.PvpType) + assert.False(world.PremiumOnly) + assert.Equal("regular", world.TransferType) + assert.Equal(0, len(world.WorldsQuestTitles)) + assert.True(world.BattleyeProtected) + assert.Equal("2024-04-10", world.BattleyeDate) + assert.Equal("regular", world.GameWorldType) + assert.Empty(world.TournamentWorldType) + assert.Equal(0, len(world.OnlinePlayers)) +} diff --git a/src/static/testdata/worlds/world/Oceanis.html b/src/static/testdata/worlds/world/Oceanis.html new file mode 100644 index 00000000..b5d2fb92 --- /dev/null +++ b/src/static/testdata/worlds/world/Oceanis.html @@ -0,0 +1,779 @@ + + + +
+

+
|
Use XP Boosts!
