Skip to content

Commit

Permalink
fix: TestFetchServerByID broken (#178)
Browse files Browse the repository at this point in the history
* fix: TestFetchServerByID broken
* chore: add server list checking
  • Loading branch information
r3inbowari authored Feb 23, 2024
1 parent d89d306 commit 3e1d8b0
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions speedtest/server_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package speedtest

import (
"errors"
"math"
"math/rand"
"testing"
Expand Down Expand Up @@ -151,13 +152,21 @@ func TestCustomServer(t *testing.T) {
}

func TestFetchServerByID(t *testing.T) {
remoteList, err := FetchServers()
if err != nil {
t.Fatal(err)
}

if remoteList.Len() < 1 {
t.Fatal(errors.New("server not found"))
}

testData := map[string]bool{
"45170": true,
"-99999999": false,
"28910": true,
"どうも": false,
"hello": false,
"你好": false,
remoteList[0].ID: true,
"-99999999": false,
"どうも": false,
"hello": false,
"你好": false,
}

for id, b := range testData {
Expand Down

0 comments on commit 3e1d8b0

Please sign in to comment.