-
Notifications
You must be signed in to change notification settings - Fork 3
/
jit.presale.rule_test.go
57 lines (55 loc) · 1.33 KB
/
jit.presale.rule_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
package temu
import (
"context"
"fmt"
"github.com/hiscaler/temu-go/entity"
"github.com/stretchr/testify/assert"
"testing"
)
func Test_jitPresaleRuleService_Query(t *testing.T) {
type args struct {
ctx context.Context
}
s := temuClient.Services.Jit.PresaleRule
tests := []struct {
name string
s jitPresaleRuleService
args args
wantRule entity.JitPresaleRule
wantErr assert.ErrorAssertionFunc
}{
{
name: "1",
s: s,
args: args{ctx},
wantRule: entity.JitPresaleRule{
Version: 3,
ProtocolUrl: "https://bdl.cdnfe.com/upload_bdl/seller-protocol/86042e8a-1f7f-4e30-b0d3-e325509d0f79.html",
},
wantErr: func(t assert.TestingT, err error, i ...interface{}) bool {
return err == nil
},
},
{
name: "2",
s: s,
args: args{ctx},
wantRule: entity.JitPresaleRule{
Version: 0,
ProtocolUrl: "https://bdl.cdnfe.com/upload_bdl/seller-protocol/86042e8a-1f7f-4e30-b0d3-e325509d0f79.html",
},
wantErr: func(t assert.TestingT, err error, i ...interface{}) bool {
return err != nil
},
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
gotRule, err := tt.s.Query(tt.args.ctx)
if !tt.wantErr(t, err, fmt.Sprintf("Query(%v)", tt.args.ctx)) {
return
}
assert.Equalf(t, tt.wantRule, gotRule, "Query(%v)", tt.args.ctx)
})
}
}