69 lines
1.5 KiB
Go
69 lines
1.5 KiB
Go
package dao
|
|
|
|
import (
|
|
"context"
|
|
"testing"
|
|
|
|
"github.com/smartystreets/goconvey/convey"
|
|
)
|
|
|
|
func TestDaonoticeHit(t *testing.T) {
|
|
convey.Convey("noticeHit", t, func(ctx convey.C) {
|
|
var (
|
|
mid = int64(0)
|
|
)
|
|
ctx.Convey("When everything goes positive", func(ctx convey.C) {
|
|
p1 := noticeHit(mid)
|
|
ctx.Convey("Then p1 should not be nil.", func(ctx convey.C) {
|
|
ctx.So(p1, convey.ShouldNotBeNil)
|
|
})
|
|
})
|
|
})
|
|
}
|
|
|
|
func TestDaonoticeKey(t *testing.T) {
|
|
convey.Convey("noticeKey", t, func(ctx convey.C) {
|
|
var (
|
|
mid = int64(0)
|
|
)
|
|
ctx.Convey("When everything goes positive", func(ctx convey.C) {
|
|
p1 := noticeKey(mid)
|
|
ctx.Convey("Then p1 should not be nil.", func(ctx convey.C) {
|
|
ctx.So(p1, convey.ShouldNotBeNil)
|
|
})
|
|
})
|
|
})
|
|
}
|
|
|
|
func TestDaoRawNotice(t *testing.T) {
|
|
convey.Convey("RawNotice", t, func(ctx convey.C) {
|
|
var (
|
|
c = context.Background()
|
|
mid = int64(0)
|
|
)
|
|
ctx.Convey("When everything goes positive", func(ctx convey.C) {
|
|
res, err := d.RawNotice(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 TestDaoSetNotice(t *testing.T) {
|
|
convey.Convey("SetNotice", t, func(ctx convey.C) {
|
|
var (
|
|
c = context.Background()
|
|
mid = int64(0)
|
|
notice = ""
|
|
)
|
|
ctx.Convey("When everything goes positive", func(ctx convey.C) {
|
|
err := d.SetNotice(c, mid, notice)
|
|
ctx.Convey("Then err should be nil.", func(ctx convey.C) {
|
|
ctx.So(err, convey.ShouldBeNil)
|
|
})
|
|
})
|
|
})
|
|
}
|