test: add integration tests for OSRS and RS3 wiki searches and page fetches #2

Merged
sam merged 3 commits from claude/issue-1-write-unit-tests into main 2026-03-05 20:09:38 -06:00
2 changed files with 8 additions and 7 deletions
Showing only changes of commit efc227ac90 - Show all commits

View File

@@ -382,7 +382,7 @@ func TestOSRS_GetPageSection_MiningTraining_FirstSection(t *testing.T) {
} }
func TestRS3_GetPage_PrayerTraining_Sections(t *testing.T) { func TestRS3_GetPage_PrayerTraining_Sections(t *testing.T) {
page, err := rs3Client().GetPage("Prayer training") page, err := rs3Client().GetPage("Pay-to-play Prayer training")
if err != nil { if err != nil {
t.Fatalf("GetPage failed: %v", err) t.Fatalf("GetPage failed: %v", err)
} }
@@ -396,7 +396,7 @@ func TestRS3_GetPage_PrayerTraining_Sections(t *testing.T) {
} }
func TestRS3_GetPageSection_PrayerTraining_BonesSection(t *testing.T) { func TestRS3_GetPageSection_PrayerTraining_BonesSection(t *testing.T) {
page, err := rs3Client().GetPage("Prayer training") page, err := rs3Client().GetPage("Pay-to-play Prayer training")
if err != nil { if err != nil {
t.Fatalf("GetPage failed: %v", err) t.Fatalf("GetPage failed: %v", err)
} }
@@ -406,7 +406,7 @@ func TestRS3_GetPageSection_PrayerTraining_BonesSection(t *testing.T) {
t.Skip("no bones/altars section found") t.Skip("no bones/altars section found")
} }
section, err := rs3Client().GetPageSection("Prayer training", idx) section, err := rs3Client().GetPageSection("Pay-to-play Prayer training", idx)
if err != nil { if err != nil {
t.Fatalf("GetPageSection failed: %v", err) t.Fatalf("GetPageSection failed: %v", err)
} }

View File

@@ -76,6 +76,7 @@ func (c *Client) GetPageSection(title string, sectionIndex int) (*ParsedPage, er
"page": {title}, "page": {title},
"prop": {"wikitext"}, "prop": {"wikitext"},
"section": {strconv.Itoa(sectionIndex)}, "section": {strconv.Itoa(sectionIndex)},
"redirects": {"1"},
} }
var resp parseResponse var resp parseResponse