You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
223 lines
4.2 KiB
Go
223 lines
4.2 KiB
Go
package script
|
|
|
|
import (
|
|
"context"
|
|
"joybuywork/internal/consts"
|
|
"testing"
|
|
"time"
|
|
|
|
"github.com/rs/xid"
|
|
|
|
_ "joybuywork/test"
|
|
)
|
|
|
|
func TestLang(t *testing.T) {
|
|
|
|
taskId := xid.New().String()
|
|
ctx := context.Background()
|
|
ctx = context.WithValue(ctx, consts.CtxBootId, taskId)
|
|
c := lang{
|
|
ctx: ctx,
|
|
taskId: taskId,
|
|
}
|
|
|
|
c.lang()
|
|
}
|
|
|
|
func TestLangModule(t *testing.T) {
|
|
|
|
taskId := xid.New().String()
|
|
ctx := context.Background()
|
|
ctx = context.WithValue(ctx, consts.CtxBootId, taskId)
|
|
c := langModule{
|
|
ctx: ctx,
|
|
taskId: taskId,
|
|
}
|
|
|
|
c.langModule()
|
|
}
|
|
|
|
func TestLangTextMark(t *testing.T) {
|
|
|
|
taskId := xid.New().String()
|
|
ctx := context.Background()
|
|
ctx = context.WithValue(ctx, consts.CtxBootId, taskId)
|
|
c := langTextMark{
|
|
ctx: ctx,
|
|
taskId: taskId,
|
|
}
|
|
|
|
c.langTextMark()
|
|
}
|
|
|
|
func TestCheckLang(t *testing.T) {
|
|
|
|
taskId := xid.New().String()
|
|
ctx := context.Background()
|
|
ctx = context.WithValue(ctx, consts.CtxBootId, taskId)
|
|
c := checkLang{
|
|
ctx: ctx,
|
|
taskId: taskId,
|
|
}
|
|
|
|
c.checkLang()
|
|
}
|
|
|
|
func TestFillLang(t *testing.T) {
|
|
|
|
taskId := xid.New().String()
|
|
ctx := context.Background()
|
|
ctx = context.WithValue(ctx, consts.CtxBootId, taskId)
|
|
c := fillLang{
|
|
ctx: ctx,
|
|
taskId: taskId,
|
|
}
|
|
|
|
c.fillLang()
|
|
}
|
|
|
|
func TestOpenPushLadder(t *testing.T) {
|
|
|
|
taskId := xid.New().String()
|
|
ctx := context.Background()
|
|
ctx = context.WithValue(ctx, consts.CtxBootId, taskId)
|
|
c := openPushLadder{
|
|
ctx: ctx,
|
|
taskId: taskId,
|
|
ProjectId: 143,
|
|
ProjectHashId: "",
|
|
Open: 1,
|
|
}
|
|
|
|
c.openPushLadder()
|
|
}
|
|
|
|
func TestFixData(t *testing.T) {
|
|
|
|
taskId := xid.New().String()
|
|
ctx := context.Background()
|
|
ctx = context.WithValue(ctx, consts.CtxBootId, taskId)
|
|
c := fixData{
|
|
ctx: ctx,
|
|
taskId: taskId,
|
|
CampaignHashId: "d34cfv6rdj7q4t79q220",
|
|
Date: "2026-07-13 19:03:30",
|
|
}
|
|
|
|
c.fixData()
|
|
}
|
|
|
|
func TestFixData2(t *testing.T) {
|
|
|
|
taskId := xid.New().String()
|
|
ctx := context.Background()
|
|
ctx = context.WithValue(ctx, consts.CtxBootId, taskId)
|
|
c := fixData2{
|
|
ctx: ctx,
|
|
taskId: taskId,
|
|
CampaignHashId: "d1363eerdj7quq5bpakg",
|
|
}
|
|
|
|
c.fixData2()
|
|
}
|
|
|
|
func TestTestGetWebReward(t *testing.T) {
|
|
|
|
taskId := xid.New().String()
|
|
ctx := context.Background()
|
|
ctx = context.WithValue(ctx, consts.CtxBootId, taskId)
|
|
c := testGetWebReward{
|
|
ctx: ctx,
|
|
taskId: taskId,
|
|
CampaignHashId: "cpm0cumrdj7q5fjo0lk0",
|
|
WebId: "cppq1surdj7k8gjm3cb0",
|
|
}
|
|
|
|
c.testGetWebReward()
|
|
}
|
|
|
|
func TestClearStock(t *testing.T) {
|
|
|
|
taskId := xid.New().String()
|
|
ctx := context.Background()
|
|
ctx = context.WithValue(ctx, consts.CtxBootId, taskId)
|
|
c := clearStock{
|
|
ctx: ctx,
|
|
taskId: taskId,
|
|
CampaignId: 3203,
|
|
}
|
|
|
|
c.clearStock()
|
|
}
|
|
|
|
func TestTaskCenterLang(t *testing.T) {
|
|
|
|
taskId := xid.New().String()
|
|
ctx := context.Background()
|
|
ctx = context.WithValue(ctx, consts.CtxBootId, taskId)
|
|
c := taskCenterLang{
|
|
ctx: ctx,
|
|
taskId: taskId,
|
|
}
|
|
|
|
c.taskCenterLang()
|
|
|
|
time.Sleep(time.Second)
|
|
}
|
|
|
|
func TestSetLangParts(t *testing.T) {
|
|
|
|
taskId := xid.New().String()
|
|
ctx := context.Background()
|
|
ctx = context.WithValue(ctx, consts.CtxBootId, taskId)
|
|
c := setLangParts{
|
|
ctx: ctx,
|
|
taskId: taskId,
|
|
Mark: "cat",
|
|
Parts: "common,media,tip,pet,task,show_detail,form,icon,rule,grow_task,reward_show,invite_record,child,chat",
|
|
}
|
|
|
|
c.setLangParts()
|
|
|
|
c1 := setLangParts{
|
|
ctx: ctx,
|
|
taskId: taskId,
|
|
Mark: "gold_dog",
|
|
Parts: "common,media,tip,keep_dog,task,show_detail,form,icon,rule,grow_task,reward_show,invite_record,child,chat",
|
|
}
|
|
|
|
c1.setLangParts()
|
|
|
|
c2 := setLangParts{
|
|
ctx: ctx,
|
|
taskId: taskId,
|
|
Mark: "keep_dog",
|
|
Parts: "common,media,tip,keep_dog,task,show_detail,form,icon,rule,grow_task,reward_show,invite_record,child,chat",
|
|
}
|
|
|
|
c2.setLangParts()
|
|
}
|
|
|
|
func TestStatCampaign(t *testing.T) {
|
|
|
|
taskId := xid.New().String()
|
|
ctx := context.Background()
|
|
ctx = context.WithValue(ctx, consts.CtxBootId, taskId)
|
|
c := statCampaign{
|
|
ctx: ctx,
|
|
taskId: taskId,
|
|
BehaviorType: 0,
|
|
IpAddress: "",
|
|
UserID: "",
|
|
DeviceID: "",
|
|
Event: "",
|
|
EventData: nil,
|
|
ProjectID: 0,
|
|
Hid: 0,
|
|
TsHID: "",
|
|
Language: "",
|
|
}
|
|
|
|
c.statCampaign()
|
|
}
|