Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/TibiaWorldsWorld.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
38 changes: 38 additions & 0 deletions src/TibiaWorldsWorld_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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))
}
Loading