-
Notifications
You must be signed in to change notification settings - Fork 0
/
leagues_test.go
61 lines (46 loc) · 1.44 KB
/
leagues_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
package main
import (
"context"
"log/slog"
"testing"
"time"
"github.com/leighmacdonald/steamid/v4/steamid"
"github.com/stretchr/testify/require"
)
var (
testIDb4nny = steamid.New("76561197970669109")
testIDCamper = steamid.New("76561197992870439")
)
func TestGetLogsTF(t *testing.T) {
t.Parallel()
count, errLogs := getLogsTF(context.Background(), testIDb4nny)
require.NoError(t, errLogs)
require.Less(t, int64(13000), count)
countZero, errLogsZero := getLogsTF(context.Background(), steamid.New(testIDb4nny.Int64()+2))
require.NoError(t, errLogsZero)
require.Equal(t, int64(0), countZero)
}
func TestGetUGC(t *testing.T) {
t.Parallel()
seasons, errLogs := getUGC(context.Background(), testIDb4nny)
require.NoError(t, errLogs)
require.GreaterOrEqual(t, 30, len(seasons))
}
func TestETF2L(t *testing.T) {
t.Parallel()
c, cancel := context.WithTimeout(context.Background(), time.Second*25)
defer cancel()
seasons, err := getETF2L(c, testIDb4nny)
require.NoError(t, err)
require.Greater(t, len(seasons), 3)
}
func TestRGL(t *testing.T) {
t.Parallel()
seasons, errSeasons := getRGL(context.Background(), slog.Default(), steamid.New(76561198084134025))
if errSeasons != nil {
// Dumb hack because rgl api often just doesn't work on the first call...
seasons, errSeasons = getRGL(context.Background(), slog.Default(), steamid.New(76561198084134025))
}
require.NoError(t, errSeasons)
require.LessOrEqual(t, 1, len(seasons))
}