MCPcopy Create free account
hub / github.com/FloatTech/ZeroBot-Plugin / Test_PingListInfo

Function Test_PingListInfo

plugin/minecraftobserver/ping_test.go:8–27  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

6)
7
8func Test_PingListInfo(t *testing.T) {
9 t.Run("normal", func(t *testing.T) {
10 resp, err := getMinecraftServerStatus("cn.nekoland.top")
11 if err != nil {
12 t.Fatalf("getMinecraftServerStatus() error = %v", err)
13 }
14 msg, iconBase64 := resp.genServerSubscribeSchema("cn.nekoland.top", 123456).generateServerStatusMsg()
15 fmt.Printf("msg: %v\n", msg)
16 fmt.Printf("iconBase64: %v\n", iconBase64)
17 })
18 t.Run("不可达", func(t *testing.T) {
19 ss, err := getMinecraftServerStatus("dx.123213213123123.net")
20 if err == nil {
21 t.Fatalf("getMinecraftServerStatus() error = %v", err)
22 }
23 if ss != nil {
24 t.Fatalf("getMinecraftServerStatus() got = %v, want nil", ss)
25 }
26 })
27}

Callers

nothing calls this directly

Calls 3

getMinecraftServerStatusFunction · 0.85

Tested by

no test coverage detected