123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132 |
- package dao
- import (
- "context"
- "testing"
- "github.com/smartystreets/goconvey/convey"
- )
- func TestDaoTotalBannerCount(t *testing.T) {
- convey.Convey("TotalBannerCount", t, func(ctx convey.C) {
- var (
- c = context.Background()
- )
- ctx.Convey("When everything goes positive", func(ctx convey.C) {
- count, err := d.TotalBannerCount(c)
- ctx.Convey("Then err should be nil.count should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- ctx.So(count, convey.ShouldNotBeNil)
- })
- })
- })
- }
- func TestDaoDupEditBanner(t *testing.T) {
- convey.Convey("DupEditBanner", t, func(ctx convey.C) {
- var (
- c = context.Background()
- startAt = int64(0)
- endAt = int64(0)
- now = int64(0)
- id = int64(0)
- )
- ctx.Convey("When everything goes positive", func(ctx convey.C) {
- dup, err := d.DupEditBanner(c, startAt, endAt, now, id)
- ctx.Convey("Then err should be nil.dup should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- ctx.So(dup, convey.ShouldNotBeNil)
- })
- })
- })
- }
- func TestDaoDupBanner(t *testing.T) {
- convey.Convey("DupBanner", t, func(ctx convey.C) {
- var (
- c = context.Background()
- startAt = int64(0)
- endAt = int64(0)
- now = int64(0)
- )
- ctx.Convey("When everything goes positive", func(ctx convey.C) {
- dup, err := d.DupBanner(c, startAt, endAt, now)
- ctx.Convey("Then err should be nil.dup should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- ctx.So(dup, convey.ShouldNotBeNil)
- })
- })
- })
- }
- func TestDaoInsertBanner(t *testing.T) {
- convey.Convey("InsertBanner", t, func(ctx convey.C) {
- var (
- c = context.Background()
- image = ""
- link = ""
- startAt = int64(0)
- endAt = int64(0)
- )
- ctx.Convey("When everything goes positive", func(ctx convey.C) {
- rows, err := d.InsertBanner(c, image, link, startAt, endAt)
- ctx.Convey("Then err should be nil.rows should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- ctx.So(rows, convey.ShouldNotBeNil)
- })
- })
- })
- }
- func TestDaoBanners(t *testing.T) {
- convey.Convey("Banners", t, func(ctx convey.C) {
- var (
- c = context.Background()
- offset = int64(0)
- limit = int64(10)
- )
- ctx.Convey("When everything goes positive", func(ctx convey.C) {
- _, err := d.Banners(c, offset, limit)
- ctx.Convey("Then err should be nil.bs should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- })
- })
- })
- }
- func TestDaoUpdateBanner(t *testing.T) {
- convey.Convey("UpdateBanner", t, func(ctx convey.C) {
- var (
- c = context.Background()
- image = ""
- link = ""
- startAt = int64(0)
- endAt = int64(0)
- id = int64(0)
- )
- ctx.Convey("When everything goes positive", func(ctx convey.C) {
- rows, err := d.UpdateBanner(c, image, link, startAt, endAt, id)
- ctx.Convey("Then err should be nil.rows should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- ctx.So(rows, convey.ShouldNotBeNil)
- })
- })
- })
- }
- func TestDaoUpdateBannerEndAt(t *testing.T) {
- convey.Convey("UpdateBannerEndAt", t, func(ctx convey.C) {
- var (
- c = context.Background()
- endAt = int64(0)
- id = int64(0)
- )
- ctx.Convey("When everything goes positive", func(ctx convey.C) {
- rows, err := d.UpdateBannerEndAt(c, endAt, id)
- ctx.Convey("Then err should be nil.rows should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- ctx.So(rows, convey.ShouldNotBeNil)
- })
- })
- })
- }
|