109 lines
2.7 KiB
Go
109 lines
2.7 KiB
Go
package wiki_test
|
|
|
|
import (
|
|
"testing"
|
|
)
|
|
|
|
// --- RS3 Exchange Module Tests ---
|
|
|
|
func TestRS3_GetExchangeModule_AbyssalWhip(t *testing.T) {
|
|
item, err := rs3Client().GetExchangeModule("Abyssal whip")
|
|
if err != nil {
|
|
t.Fatalf("GetExchangeModule failed: %v", err)
|
|
}
|
|
if item == nil {
|
|
t.Fatal("expected non-nil exchange item for Abyssal whip")
|
|
}
|
|
|
|
if item.ItemID != 4151 {
|
|
t.Errorf("expected item ID 4151, got %d", item.ItemID)
|
|
}
|
|
if item.Name != "Abyssal whip" {
|
|
t.Errorf("expected name 'Abyssal whip', got %q", item.Name)
|
|
}
|
|
if !item.Members {
|
|
t.Error("expected Abyssal whip to be members-only")
|
|
}
|
|
if item.Limit <= 0 {
|
|
t.Errorf("expected positive buy limit, got %d", item.Limit)
|
|
}
|
|
if item.Value <= 0 {
|
|
t.Errorf("expected positive store value, got %d", item.Value)
|
|
}
|
|
if item.Examine == "" {
|
|
t.Error("expected non-empty examine text")
|
|
}
|
|
}
|
|
|
|
func TestRS3_GetExchangeModule_BluePartyhat(t *testing.T) {
|
|
item, err := rs3Client().GetExchangeModule("Blue partyhat")
|
|
if err != nil {
|
|
t.Fatalf("GetExchangeModule failed: %v", err)
|
|
}
|
|
if item == nil {
|
|
t.Fatal("expected non-nil exchange item for Blue partyhat")
|
|
}
|
|
|
|
if item.ItemID != 1042 {
|
|
t.Errorf("expected item ID 1042, got %d", item.ItemID)
|
|
}
|
|
if item.Members {
|
|
t.Error("expected Blue partyhat to not be members-only")
|
|
}
|
|
if item.Limit <= 0 {
|
|
t.Errorf("expected positive buy limit, got %d", item.Limit)
|
|
}
|
|
}
|
|
|
|
func TestRS3_GetExchangeModule_DragonBones(t *testing.T) {
|
|
item, err := rs3Client().GetExchangeModule("Dragon bones")
|
|
if err != nil {
|
|
t.Fatalf("GetExchangeModule failed: %v", err)
|
|
}
|
|
if item == nil {
|
|
t.Fatal("expected non-nil exchange item for Dragon bones")
|
|
}
|
|
|
|
if item.ItemID <= 0 {
|
|
t.Error("expected positive item ID")
|
|
}
|
|
if item.Name != "Dragon bones" {
|
|
t.Errorf("expected name 'Dragon bones', got %q", item.Name)
|
|
}
|
|
}
|
|
|
|
func TestRS3_GetExchangeModule_NonTradeableItem(t *testing.T) {
|
|
// "Quest point cape" is not tradeable, so no exchange module exists
|
|
item, err := rs3Client().GetExchangeModule("Quest point cape")
|
|
if err != nil {
|
|
t.Fatalf("GetExchangeModule failed: %v", err)
|
|
}
|
|
if item != nil {
|
|
t.Error("expected nil for non-tradeable item")
|
|
}
|
|
}
|
|
|
|
func TestRS3_GetExchangeModule_NonExistentItem(t *testing.T) {
|
|
item, err := rs3Client().GetExchangeModule("Completely Fake Item That Does Not Exist")
|
|
if err != nil {
|
|
t.Fatalf("GetExchangeModule failed: %v", err)
|
|
}
|
|
if item != nil {
|
|
t.Error("expected nil for non-existent item")
|
|
}
|
|
}
|
|
|
|
func TestRS3_GetExchangeModule_HasCategory(t *testing.T) {
|
|
item, err := rs3Client().GetExchangeModule("Abyssal whip")
|
|
if err != nil {
|
|
t.Fatalf("GetExchangeModule failed: %v", err)
|
|
}
|
|
if item == nil {
|
|
t.Fatal("expected non-nil exchange item")
|
|
}
|
|
|
|
if item.Category == "" {
|
|
t.Error("expected non-empty category")
|
|
}
|
|
}
|