123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438 |
- package newcomer
- import (
- "context"
- "testing"
- "go-common/app/interface/main/creative/model/newcomer"
- "github.com/smartystreets/goconvey/convey"
- )
- func TestNewcomergetTableName(t *testing.T) {
- convey.Convey("getTableName", t, func(ctx convey.C) {
- var (
- mid = int64(27515308)
- )
- ctx.Convey("When everything goes positive", func(ctx convey.C) {
- p1 := getTableName(mid)
- ctx.Convey("Then p1 should not be nil.", func(ctx convey.C) {
- ctx.So(p1, convey.ShouldNotBeNil)
- })
- })
- })
- }
- func TestNewcomerUserTaskBind(t *testing.T) {
- convey.Convey("UserTaskBind", t, func(ctx convey.C) {
- var (
- c = context.Background()
- mid = int64(27515308)
- )
- ctx.Convey("When everything goes positive", func(ctx convey.C) {
- res, err := d.UserTaskBind(c, mid)
- ctx.Convey("Then err should be nil.res should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- ctx.So(res, convey.ShouldNotBeNil)
- })
- })
- })
- }
- func TestNewcomerIsRewardReceived(t *testing.T) {
- convey.Convey("IsRewardReceived", t, func(ctx convey.C) {
- var (
- c = context.Background()
- mid = int64(27515308)
- rid = int64(1)
- rewardType = int8(1)
- )
- ctx.Convey("When everything goes positive", func(ctx convey.C) {
- res, err := d.IsRewardReceived(c, mid, rid, rewardType)
- ctx.Convey("Then err should be nil.res should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- ctx.So(res, convey.ShouldNotBeNil)
- })
- })
- })
- }
- func TestNewcomerRewardReceivedGroup(t *testing.T) {
- convey.Convey("RewardReceivedGroup", t, func(ctx convey.C) {
- var (
- c = context.Background()
- mid = int64(27515308)
- ids = []int64{1, 2, 3}
- )
- ctx.Convey("When everything goes positive", func(ctx convey.C) {
- res, err := d.RewardReceivedGroup(c, mid, ids)
- ctx.Convey("Then err should be nil.res should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- ctx.So(res, convey.ShouldNotBeNil)
- })
- })
- })
- }
- func TestNewcomerGiftRewards(t *testing.T) {
- convey.Convey("GiftRewards", t, func(ctx convey.C) {
- var (
- c = context.Background()
- taskType = int8(1)
- )
- ctx.Convey("When everything goes positive", func(ctx convey.C) {
- res, err := d.GiftRewards(c, taskType)
- ctx.Convey("Then err should be nil.res should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- ctx.So(res, convey.ShouldNotBeNil)
- })
- })
- })
- }
- func TestNewcomerTaskGroupRewards(t *testing.T) {
- convey.Convey("TaskGroupRewards", t, func(ctx convey.C) {
- var (
- c = context.Background()
- groupID = int64(1)
- )
- ctx.Convey("When everything goes positive", func(ctx convey.C) {
- res, err := d.TaskGroupRewards(c, groupID)
- ctx.Convey("Then err should be nil.res should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- ctx.So(res, convey.ShouldNotBeNil)
- })
- })
- })
- }
- func TestNewcomerRewardCompleteState(t *testing.T) {
- convey.Convey("RewardCompleteState", t, func(ctx convey.C) {
- var (
- c = context.Background()
- mid = int64(27515308)
- tids = []int64{1, 2, 3}
- )
- ctx.Convey("When everything goes positive", func(ctx convey.C) {
- res, err := d.RewardCompleteState(c, mid, tids)
- ctx.Convey("Then err should be nil.res should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- ctx.So(res, convey.ShouldNotBeNil)
- })
- })
- })
- }
- func TestNewcomerRewardReceive(t *testing.T) {
- convey.Convey("RewardReceive", t, func(ctx convey.C) {
- var (
- c = context.Background()
- places = "(?, ?, ?, ?, ? ,?)"
- args = []interface{}{1, 1, 1, 1, 1, 1}
- )
- ctx.Convey("When everything goes positive", func(ctx convey.C) {
- p1, err := d.RewardReceive(c, places, args)
- ctx.Convey("Then err should be nil.p1 should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- ctx.So(p1, convey.ShouldNotBeNil)
- })
- })
- })
- }
- func TestNewcomerRewardActivate(t *testing.T) {
- convey.Convey("RewardActivate", t, func(ctx convey.C) {
- var (
- c = context.Background()
- mid = int64(27515308)
- id = int64(2)
- )
- ctx.Convey("When everything goes positive", func(ctx convey.C) {
- p1, err := d.RewardActivate(c, mid, id)
- ctx.Convey("Then err should be nil.p1 should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- ctx.So(p1, convey.ShouldNotBeNil)
- })
- })
- })
- }
- func TestNewcomerRewardReceives(t *testing.T) {
- convey.Convey("RewardReceives", t, func(ctx convey.C) {
- var (
- c = context.Background()
- mid = int64(27515308)
- )
- ctx.Convey("When everything goes positive", func(ctx convey.C) {
- res, err := d.RewardReceives(c, mid)
- ctx.Convey("Then err should be nil.res should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- ctx.So(res, convey.ShouldNotBeNil)
- })
- })
- })
- }
- func TestNewcomerRewards(t *testing.T) {
- convey.Convey("Rewards", t, func(ctx convey.C) {
- var (
- c = context.Background()
- )
- ctx.Convey("When everything goes positive", func(ctx convey.C) {
- res, err := d.Rewards(c)
- ctx.Convey("Then err should be nil.res should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- ctx.So(res, convey.ShouldNotBeNil)
- })
- })
- })
- }
- func TestNewcomerGiftRewardCount(t *testing.T) {
- convey.Convey("GiftRewardCount", t, func(ctx convey.C) {
- var (
- c = context.Background()
- mid = int64(27515308)
- ids = []int64{1}
- )
- ctx.Convey("When everything goes positive", func(ctx convey.C) {
- res, err := d.GiftRewardCount(c, mid, ids)
- ctx.Convey("Then err should be nil.res should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- ctx.So(res, convey.ShouldNotBeNil)
- })
- })
- })
- }
- func TestNewcomerBaseRewardCount(t *testing.T) {
- convey.Convey("BaseRewardCount", t, func(ctx convey.C) {
- var (
- c = context.Background()
- mid = int64(27515308)
- ids = []int64{1}
- )
- ctx.Convey("When everything goes positive", func(ctx convey.C) {
- res, err := d.BaseRewardCount(c, mid, ids)
- ctx.Convey("Then err should be nil.res should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- ctx.So(res, convey.ShouldNotBeNil)
- })
- })
- })
- }
- func TestNewcomerTasks(t *testing.T) {
- convey.Convey("Tasks", t, func(ctx convey.C) {
- var (
- c = context.Background()
- )
- ctx.Convey("When everything goes positive", func(ctx convey.C) {
- res, err := d.Tasks(c)
- ctx.Convey("Then err should be nil.res should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- ctx.So(res, convey.ShouldNotBeNil)
- })
- })
- })
- }
- func TestNewcomerUserTasksByMID(t *testing.T) {
- convey.Convey("UserTasksByMID", t, func(ctx convey.C) {
- var (
- c = context.Background()
- mid = int64(27515308)
- )
- ctx.Convey("When everything goes positive", func(ctx convey.C) {
- res, err := d.UserTasksByMID(c, mid)
- ctx.Convey("Then err should be nil.res should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- ctx.So(res, convey.ShouldNotBeNil)
- })
- })
- })
- }
- func TestNewcomerUpUserTask(t *testing.T) {
- convey.Convey("UpUserTask", t, func(ctx convey.C) {
- var (
- c = context.Background()
- mid = int64(27515308)
- tid = int64(1)
- )
- ctx.Convey("When everything goes positive", func(ctx convey.C) {
- p1, err := d.UpUserTask(c, mid, tid)
- ctx.Convey("Then err should be nil.p1 should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- ctx.So(p1, convey.ShouldNotBeNil)
- })
- })
- })
- }
- func TestNewcomerUserTaskType(t *testing.T) {
- convey.Convey("UserTaskType", t, func(ctx convey.C) {
- var (
- c = context.Background()
- mid = int64(27515308)
- )
- ctx.Convey("When everything goes positive", func(ctx convey.C) {
- res, err := d.UserTaskType(c, mid)
- ctx.Convey("Then err should be nil.res should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- ctx.So(res, convey.ShouldNotBeNil)
- })
- })
- })
- }
- func TestNewcomerAllTaskGroupRewards(t *testing.T) {
- convey.Convey("AllTaskGroupRewards", t, func(ctx convey.C) {
- var (
- c = context.Background()
- )
- ctx.Convey("When everything goes positive", func(ctx convey.C) {
- res, err := d.AllTaskGroupRewards(c)
- ctx.Convey("Then err should be nil.res should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- ctx.So(res, convey.ShouldNotBeNil)
- })
- })
- })
- }
- func TestNewcomerAllGiftRewards(t *testing.T) {
- convey.Convey("AllGiftRewards", t, func(ctx convey.C) {
- var (
- c = context.Background()
- )
- ctx.Convey("When everything goes positive", func(ctx convey.C) {
- res, err := d.AllGiftRewards(c)
- ctx.Convey("Then err should be nil.res should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- ctx.So(res, convey.ShouldNotBeNil)
- })
- })
- })
- }
- func TestNewcomerUserTasks(t *testing.T) {
- convey.Convey("UserTasks", t, func(ctx convey.C) {
- var (
- c = context.Background()
- mid = int64(27515308)
- )
- ctx.Convey("When everything goes positive", func(ctx convey.C) {
- res, err := d.UserTasks(c, mid)
- ctx.Convey("Then err should be nil.res should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- ctx.So(res, convey.ShouldNotBeNil)
- })
- })
- })
- }
- func TestNewcomerRewardReceiveByID(t *testing.T) {
- convey.Convey("RewardReceiveByID", t, func(ctx convey.C) {
- var (
- c = context.Background()
- mid = int64(27515308)
- rid = int64(2)
- )
- ctx.Convey("When everything goes positive", func(ctx convey.C) {
- res, err := d.RewardReceiveByID(c, mid, rid)
- ctx.Convey("Then err should be nil.res should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- ctx.So(res, convey.ShouldNotBeNil)
- })
- })
- })
- }
- func TestNewcomerTaskGroups(t *testing.T) {
- convey.Convey("TaskGroups", t, func(ctx convey.C) {
- var (
- c = context.Background()
- )
- ctx.Convey("When everything goes positive", func(ctx convey.C) {
- res, err := d.TaskGroups(c)
- ctx.Convey("Then err should be nil.res should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- ctx.So(res, convey.ShouldNotBeNil)
- })
- })
- })
- }
- func TestNewcomerTaskRewards(t *testing.T) {
- convey.Convey("TaskRewards", t, func(ctx convey.C) {
- var (
- c = context.Background()
- )
- ctx.Convey("When everything goes positive", func(ctx convey.C) {
- res, err := d.TaskRewards(c)
- ctx.Convey("Then err should be nil.res should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- ctx.So(res, convey.ShouldNotBeNil)
- })
- })
- })
- }
- func TestNewcomerRewardReceive2(t *testing.T) {
- convey.Convey("RewardReceive2", t, func(ctx convey.C) {
- var (
- c = context.Background()
- rrs = make([]*newcomer.RewardReceive2, 0)
- mid = int64(27515308)
- )
- ctx.Convey("When everything goes positive", func(ctx convey.C) {
- res, err := d.RewardReceive2(c, mid, rrs)
- ctx.Convey("Then err should be nil.res should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- ctx.So(res, convey.ShouldNotBeNil)
- })
- })
- })
- }
- func TestNewcomerRewardReceiveByOldInfo(t *testing.T) {
- convey.Convey("RewardReceiveByOldInfo", t, func(ctx convey.C) {
- var (
- c = context.Background()
- mid = int64(27515308)
- r = &newcomer.RewardReceive{
- ID: 2,
- MID: mid,
- TaskGiftID: 0,
- TaskGroupID: 2,
- RewardID: 7,
- }
- )
- ctx.Convey("When everything goes positive", func(ctx convey.C) {
- res, err := d.RewardReceiveByOldInfo(c, r)
- ctx.Convey("Then err should be nil.res should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- ctx.So(res, convey.ShouldNotBeNil)
- })
- })
- })
- }
- func TestNewcomerRewardActivate2(t *testing.T) {
- convey.Convey("RewardActivate2", t, func(ctx convey.C) {
- var (
- c = context.Background()
- mid = int64(27515308)
- oid = int64(2)
- nid = int64(1)
- )
- ctx.Convey("When everything goes positive", func(ctx convey.C) {
- res, err := d.RewardActivate2(c, mid, oid, nid)
- ctx.Convey("Then err should be nil.res should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- ctx.So(res, convey.ShouldNotBeNil)
- })
- })
- })
- }
|