123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234 |
- package fav
- import (
- "context"
- favmdl "go-common/app/service/main/favorite/model"
- "testing"
- "github.com/smartystreets/goconvey/convey"
- )
- func TestFavfolderMcKey(t *testing.T) {
- convey.Convey("folderMcKey", t, func(ctx convey.C) {
- var (
- mid = int64(0)
- fid = int64(0)
- )
- ctx.Convey("When everything goes positive", func(ctx convey.C) {
- p1 := folderMcKey(mid, fid)
- ctx.Convey("Then p1 should not be nil.", func(ctx convey.C) {
- ctx.So(p1, convey.ShouldNotBeNil)
- })
- })
- })
- }
- func TestFavrelationFidsKey(t *testing.T) {
- convey.Convey("relationFidsKey", t, func(ctx convey.C) {
- var (
- typ = int8(0)
- mid = int64(0)
- oid = int64(0)
- )
- ctx.Convey("When everything goes positive", func(ctx convey.C) {
- p1 := relationFidsKey(typ, mid, oid)
- ctx.Convey("Then p1 should not be nil.", func(ctx convey.C) {
- ctx.So(p1, convey.ShouldNotBeNil)
- })
- })
- })
- }
- func TestFavoidCountKey(t *testing.T) {
- convey.Convey("oidCountKey", t, func(ctx convey.C) {
- var (
- typ = int8(0)
- oid = int64(0)
- )
- ctx.Convey("When everything goes positive", func(ctx convey.C) {
- p1 := oidCountKey(typ, oid)
- ctx.Convey("Then p1 should not be nil.", func(ctx convey.C) {
- ctx.So(p1, convey.ShouldNotBeNil)
- })
- })
- })
- }
- func TestFavbatchOidsKey(t *testing.T) {
- convey.Convey("batchOidsKey", t, func(ctx convey.C) {
- var (
- typ = int8(0)
- mid = int64(0)
- )
- ctx.Convey("When everything goes positive", func(ctx convey.C) {
- p1 := batchOidsKey(typ, mid)
- ctx.Convey("Then p1 should not be nil.", func(ctx convey.C) {
- ctx.So(p1, convey.ShouldNotBeNil)
- })
- })
- })
- }
- func TestFavrecentOidsKey(t *testing.T) {
- convey.Convey("recentOidsKey", t, func(ctx convey.C) {
- var (
- typ = int8(0)
- mid = int64(0)
- )
- ctx.Convey("When everything goes positive", func(ctx convey.C) {
- p1 := recentOidsKey(typ, mid)
- ctx.Convey("Then p1 should not be nil.", func(ctx convey.C) {
- ctx.So(p1, convey.ShouldNotBeNil)
- })
- })
- })
- }
- func TestFavPingMC(t *testing.T) {
- convey.Convey("PingMC", t, func(ctx convey.C) {
- var (
- c = context.Background()
- )
- ctx.Convey("When everything goes positive", func(ctx convey.C) {
- err := d.pingMC(c)
- ctx.Convey("Then err should be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- })
- })
- })
- }
- func TestFavSetFoldersMc(t *testing.T) {
- convey.Convey("SetFoldersMc", t, func(ctx convey.C) {
- var (
- c = context.Background()
- vs = &favmdl.Folder{}
- )
- ctx.Convey("When everything goes positive", func(ctx convey.C) {
- err := d.SetFoldersMc(c, vs)
- ctx.Convey("Then err should be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- })
- })
- })
- }
- func TestFavFolderMc(t *testing.T) {
- convey.Convey("FolderMc", t, func(ctx convey.C) {
- var (
- c = context.Background()
- typ = int8(0)
- mid = int64(0)
- fid = int64(0)
- )
- ctx.Convey("When everything goes positive", func(ctx convey.C) {
- f, err := d.FolderMc(c, typ, mid, fid)
- ctx.Convey("Then err should be nil.f should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- ctx.So(f, convey.ShouldNotBeNil)
- })
- })
- })
- }
- func TestFavSetRelaitonFidsMc(t *testing.T) {
- convey.Convey("SetRelaitonFidsMc", t, func(ctx convey.C) {
- var (
- c = context.Background()
- typ = int8(0)
- mid = int64(0)
- oid = int64(0)
- fids = []int64{}
- )
- ctx.Convey("When everything goes positive", func(ctx convey.C) {
- err := d.SetRelaitonFidsMc(c, typ, mid, oid, fids)
- ctx.Convey("Then err should be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- })
- })
- })
- }
- func TestFavRelaitonFidsMc(t *testing.T) {
- convey.Convey("RelaitonFidsMc", t, func(ctx convey.C) {
- var (
- c = context.Background()
- typ = int8(0)
- mid = int64(0)
- oid = int64(0)
- )
- ctx.Convey("When everything goes positive", func(ctx convey.C) {
- fids, err := d.RelaitonFidsMc(c, typ, mid, oid)
- ctx.Convey("Then err should be nil.fids should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- ctx.So(fids, convey.ShouldNotBeNil)
- })
- })
- })
- }
- func TestFavDelRelationFidsMc(t *testing.T) {
- convey.Convey("DelRelationFidsMc", t, func(ctx convey.C) {
- var (
- c = context.Background()
- typ = int8(0)
- mid = int64(0)
- oid = int64(0)
- )
- ctx.Convey("When everything goes positive", func(ctx convey.C) {
- err := d.DelRelationFidsMc(c, typ, mid, oid)
- ctx.Convey("Then err should be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- })
- })
- })
- }
- func TestFavSetOidCountMc(t *testing.T) {
- convey.Convey("SetOidCountMc", t, func(ctx convey.C) {
- var (
- c = context.Background()
- typ = int8(0)
- oid = int64(0)
- count = int64(0)
- )
- ctx.Convey("When everything goes positive", func(ctx convey.C) {
- err := d.SetOidCountMc(c, typ, oid, count)
- ctx.Convey("Then err should be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- })
- })
- })
- }
- func TestFavDelBatchOidsMc(t *testing.T) {
- convey.Convey("DelBatchOidsMc", t, func(ctx convey.C) {
- var (
- c = context.Background()
- typ = int8(0)
- mid = int64(0)
- )
- ctx.Convey("When everything goes positive", func(ctx convey.C) {
- err := d.DelBatchOidsMc(c, typ, mid)
- ctx.Convey("Then err should be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- })
- })
- })
- }
- func TestFavDelRecentOidsMc(t *testing.T) {
- convey.Convey("DelRecentOidsMc", t, func(ctx convey.C) {
- var (
- c = context.Background()
- typ = int8(0)
- mid = int64(0)
- )
- ctx.Convey("When everything goes positive", func(ctx convey.C) {
- err := d.DelRecentOidsMc(c, typ, mid)
- ctx.Convey("Then err should be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- })
- })
- })
- }
|