|
7 | 7 | "testing"
|
8 | 8 | )
|
9 | 9 |
|
10 |
| -func TestForumsSectionWorldboard(t *testing.T) { |
| 10 | +func TestForumsSectionWorldBoard(t *testing.T) { |
11 | 11 | file, err := static.TestFiles.Open("testdata/forums/section/worldboard.html")
|
12 | 12 | if err != nil {
|
13 | 13 | t.Fatalf("file opening error: %s", err)
|
@@ -48,3 +48,124 @@ func TestForumsSectionWorldboard(t *testing.T) {
|
48 | 48 | assert.Equal("Mad Mustazza", alumbra.LastPost.CharacterName)
|
49 | 49 | assert.Equal("2023-06-04T15:51:13Z", alumbra.LastPost.PostedAt)
|
50 | 50 | }
|
| 51 | + |
| 52 | +func TestForumsSectionSupportBoards(t *testing.T) { |
| 53 | + file, err := static.TestFiles.Open("testdata/forums/section/supportboards.html") |
| 54 | + if err != nil { |
| 55 | + t.Fatalf("file opening error: %s", err) |
| 56 | + } |
| 57 | + defer file.Close() |
| 58 | + |
| 59 | + data, err := io.ReadAll(file) |
| 60 | + if err != nil { |
| 61 | + t.Fatalf("File reading error: %s", err) |
| 62 | + } |
| 63 | + |
| 64 | + boardsJson, err := TibiaForumSectionImpl(string(data)) |
| 65 | + if err != nil { |
| 66 | + t.Fatal(err) |
| 67 | + } |
| 68 | + |
| 69 | + assert := assert.New(t) |
| 70 | + |
| 71 | + assert.Equal(3, len(boardsJson.Boards)) |
| 72 | + |
| 73 | + paymentSupport := boardsJson.Boards[0] |
| 74 | + assert.Equal(20, paymentSupport.ID) |
| 75 | + assert.Equal("Payment Support", paymentSupport.Name) |
| 76 | + assert.Equal("Here you can ask questions on orders, payments and other payment issues.", paymentSupport.Description) |
| 77 | + assert.Equal(14468, paymentSupport.Threads) |
| 78 | + assert.Equal(56032, paymentSupport.Posts) |
| 79 | + assert.Equal(39400410, paymentSupport.LastPost.ID) |
| 80 | + assert.Equal("Dorieta", paymentSupport.LastPost.CharacterName) |
| 81 | + assert.Equal("2023-06-29T11:24:33Z", paymentSupport.LastPost.PostedAt) |
| 82 | + |
| 83 | + technicalSupport := boardsJson.Boards[1] |
| 84 | + assert.Equal(13, technicalSupport.ID) |
| 85 | + assert.Equal("Technical Support", technicalSupport.Name) |
| 86 | + assert.Equal("Here you can ask for help if you have a technical problem that is related to Tibia.", technicalSupport.Description) |
| 87 | + assert.Equal(64722, technicalSupport.Threads) |
| 88 | + assert.Equal(301828, technicalSupport.Posts) |
| 89 | + assert.Equal(39400354, technicalSupport.LastPost.ID) |
| 90 | + assert.Equal("Dio Sorcer", technicalSupport.LastPost.CharacterName) |
| 91 | + assert.Equal("2023-06-29T01:47:59Z", technicalSupport.LastPost.PostedAt) |
| 92 | + |
| 93 | + help := boardsJson.Boards[2] |
| 94 | + assert.Equal(113174, help.ID) |
| 95 | + assert.Equal("Help", help.Name) |
| 96 | + assert.Equal("Here you can ask other players all kind of questions about Tibia. Note that members of the CipSoft team will usually not reply here.", help.Description) |
| 97 | + assert.Equal(22788, help.Threads) |
| 98 | + assert.Equal(106713, help.Posts) |
| 99 | + assert.Equal(39400248, help.LastPost.ID) |
| 100 | + assert.Equal("Dekraken durinars", help.LastPost.CharacterName) |
| 101 | + assert.Equal("2023-06-28T17:17:45Z", help.LastPost.PostedAt) |
| 102 | +} |
| 103 | + |
| 104 | +func TestForumsSectionCommunityBoards(t *testing.T) { |
| 105 | + file, err := static.TestFiles.Open("testdata/forums/section/communityboards.html") |
| 106 | + if err != nil { |
| 107 | + t.Fatalf("file opening error: %s", err) |
| 108 | + } |
| 109 | + defer file.Close() |
| 110 | + |
| 111 | + data, err := io.ReadAll(file) |
| 112 | + if err != nil { |
| 113 | + t.Fatalf("File reading error: %s", err) |
| 114 | + } |
| 115 | + |
| 116 | + boardsJson, err := TibiaForumSectionImpl(string(data)) |
| 117 | + if err != nil { |
| 118 | + t.Fatal(err) |
| 119 | + } |
| 120 | + |
| 121 | + assert := assert.New(t) |
| 122 | + |
| 123 | + assert.Equal(6, len(boardsJson.Boards)) |
| 124 | + |
| 125 | + gameplay := boardsJson.Boards[0] |
| 126 | + assert.Equal(120835, gameplay.ID) |
| 127 | + assert.Equal("Gameplay (English Only)", gameplay.Name) |
| 128 | + assert.Equal("Here is the place to talk about quests, achievements and the general gameplay of Tibia.", gameplay.Description) |
| 129 | + assert.Equal(35364, gameplay.Threads) |
| 130 | + assert.Equal(335328, gameplay.Posts) |
| 131 | + assert.Equal(39400492, gameplay.LastPost.ID) |
| 132 | + assert.Equal("Dreamsphere", gameplay.LastPost.CharacterName) |
| 133 | + assert.Equal("2023-06-29T19:59:41Z", gameplay.LastPost.PostedAt) |
| 134 | + |
| 135 | + auditorium := boardsJson.Boards[5] |
| 136 | + assert.Equal(89516, auditorium.ID) |
| 137 | + assert.Equal("Auditorium (English Only)", auditorium.Name) |
| 138 | + assert.Equal("Meet Tibia's community managers and give feedback on news articles and Tibia related topics. State your opinion and see what others think and have to say.", auditorium.Description) |
| 139 | +} |
| 140 | + |
| 141 | +func TestForumsSectionTradeBoards(t *testing.T) { |
| 142 | + file, err := static.TestFiles.Open("testdata/forums/section/tradeboards.html") |
| 143 | + if err != nil { |
| 144 | + t.Fatalf("file opening error: %s", err) |
| 145 | + } |
| 146 | + defer file.Close() |
| 147 | + |
| 148 | + data, err := io.ReadAll(file) |
| 149 | + if err != nil { |
| 150 | + t.Fatalf("File reading error: %s", err) |
| 151 | + } |
| 152 | + |
| 153 | + boardsJson, err := TibiaForumSectionImpl(string(data)) |
| 154 | + if err != nil { |
| 155 | + t.Fatal(err) |
| 156 | + } |
| 157 | + |
| 158 | + assert := assert.New(t) |
| 159 | + |
| 160 | + assert.Equal(90, len(boardsJson.Boards)) |
| 161 | + |
| 162 | + adra := boardsJson.Boards[0] |
| 163 | + assert.Equal(146485, adra.ID) |
| 164 | + assert.Equal("Adra - Trade", adra.Name) |
| 165 | + assert.Equal("Use this board to make Tibia related trade offers on the game world Adra. Note that all trades must conform to the Tibia Rules.", adra.Description) |
| 166 | + assert.Equal(540, adra.Threads) |
| 167 | + assert.Equal(599, adra.Posts) |
| 168 | + assert.Equal(39400121, adra.LastPost.ID) |
| 169 | + assert.Equal("Arge Reotona", adra.LastPost.CharacterName) |
| 170 | + assert.Equal("2023-06-28T09:15:31Z", adra.LastPost.PostedAt) |
| 171 | +} |
0 commit comments