Skip to content

Commit 8bb6b3b

Browse files
committed
test: add testdata and test-function
1 parent 8c63e47 commit 8bb6b3b

File tree

2 files changed

+839
-0
lines changed

2 files changed

+839
-0
lines changed

src/TibiaCreaturesOverview_test.go

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,3 +65,29 @@ func TestOverview(t *testing.T) {
6565
assert.Equal("https://static.tibia.com/images/library/slime.gif", slimes.ImageURL)
6666
assert.False(slimes.Featured)
6767
}
68+
69+
func TestOverviewBoostedFictitious(t *testing.T) {
70+
file, err := static.TestFiles.Open("testdata/creatures/creatures_fictitious.html")
71+
if err != nil {
72+
t.Fatalf("file opening error: %s", err)
73+
}
74+
defer file.Close()
75+
76+
data, err := io.ReadAll(file)
77+
if err != nil {
78+
t.Fatalf("File reading error: %s", err)
79+
}
80+
81+
creaturesJson, err := TibiaCreaturesOverviewImpl(string(data), "https://www.tibia.com/library/?subtopic=creatures")
82+
if err != nil {
83+
t.Fatal(err)
84+
}
85+
86+
assert := assert.New(t)
87+
information := creaturesJson.Information
88+
89+
assert.Equal("https://www.tibia.com/library/?subtopic=creatures", information.TibiaURLs[0])
90+
assert.Equal("Ragged Rabid Wolf", creaturesJson.Creatures.Boosted.Name)
91+
assert.Equal("raggedrabidwolf", creaturesJson.Creatures.Boosted.Race)
92+
assert.Equal("https://static.tibia.com/images/global/header/monsters/raggedrabidwolf.gif", creaturesJson.Creatures.Boosted.ImageURL)
93+
}

0 commit comments

Comments
 (0)