This commit is contained in:
2026-07-21 03:55:57 +03:00
commit 15b428efec
39 changed files with 136724 additions and 0 deletions

138
onexbet_test.go Normal file
View File

@@ -0,0 +1,138 @@
package onexbet
import (
"encoding/json"
"fmt"
"testing"
)
/*
func TestSearchTeamCandidates(t *testing.T) {
list, err := SearchTeamMatches(tennisLiveSearchURL, "Gunko")
if err != nil {
t.Fatal(err)
}
for _, m := range list {
fmt.Printf("%#v\n\n", m)
}
}
func TestLoadTeamLiveMatchData(t *testing.T) {
data, isMatchFinished, err := LoadTeamLiveMatchData("295524958")
if err != nil {
t.Fatal(err)
}
buf, _ := json.MarshalIndent(data, "", " ")
fmt.Printf("%s\n", buf)
fmt.Printf("isMatchFinished: %t\n", isMatchFinished)
}
*/
/*
func TestSearchMatchCandidates(t *testing.T) {
list, err := SearchMatchCandidates("west ham", "manchester city", nil)
if err != nil {
t.Fatal(err)
}
for _, m := range list {
fmt.Printf("%#v\n\n", m)
}
}
*/
/*
func TestListLiveMatchesBySport(t *testing.T) {
list, err := ListLiveMatchesBySport(Tennis)
if err != nil {
t.Fatal(err)
}
for _, m := range list {
buf, _ := json.MarshalIndent(m, "", " ")
fmt.Printf("%s\n", buf)
}
}
*/
/*
func TestLoadTeamLiveMatchData(t *testing.T) {
list, err := ListLiveMatchesBySport(Handball)
if err != nil {
t.Fatal(err)
}
if len(list) == 0 {
fmt.Printf("No live matches\n")
return
}
data, err := LoadTeamLiveMatchData(list[0].MatchID)
if err != nil {
t.Fatal(err)
}
buf, _ := json.MarshalIndent(data, "", " ")
fmt.Printf("%s\n", buf)
}
*/
/*
*/
func TestGetTennisMatchResult(t *testing.T) {
onexbetStatsMatchID := "610afdf8f75a663f695c36ac"
stat, err := GetTennisMatchResult(onexbetStatsMatchID)
if err != nil {
t.Fatal(err)
}
fmt.Printf("onexbetStatsMatchID: %s\n", onexbetStatsMatchID)
buf, _ := json.MarshalIndent(stat, "", " ")
fmt.Printf("%s\n", buf)
}
/*
func TestLoadTennisLiveMatchDataOfFirstInLive(t *testing.T) {
list, err := ListLiveMatchesBySport(Tennis)
if err != nil {
t.Fatal(err)
}
if len(list) == 0 {
fmt.Printf("No live matches\n")
return
}
data, isMatchFinished, err := LoadTennisLiveMatchData(list[0].MatchID)
if err != nil {
t.Fatal(err)
}
buf, _ := json.MarshalIndent(data, "", " ")
fmt.Printf("%s\nisMatchFinished: %t\n", buf, isMatchFinished)
}
func TestLoadTennisLiveMatchData(t *testing.T) {
data, isMatchFinished, err := LoadTennisLiveMatchData("298023063")
if err != nil {
t.Fatal(err)
}
buf, _ := json.MarshalIndent(data, "", " ")
fmt.Printf("%s\nisMatchFinished: %t\n", buf, isMatchFinished)
}
*/
/*
func TestGetTeamMatchResult(t *testing.T) {
stat, err := GetTeamMatchResult("60257269f75a663f693fd68d")
if err != nil {
t.Fatal(err)
}
buf, _ := json.MarshalIndent(stat, "", " ")
fmt.Printf("%s\n", buf)
}
*/