notice_test.go 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. package dao
  2. import (
  3. "context"
  4. "testing"
  5. "github.com/smartystreets/goconvey/convey"
  6. )
  7. func TestDaonoticeHit(t *testing.T) {
  8. convey.Convey("noticeHit", t, func(ctx convey.C) {
  9. var (
  10. mid = int64(0)
  11. )
  12. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  13. p1 := noticeHit(mid)
  14. ctx.Convey("Then p1 should not be nil.", func(ctx convey.C) {
  15. ctx.So(p1, convey.ShouldNotBeNil)
  16. })
  17. })
  18. })
  19. }
  20. func TestDaonoticeKey(t *testing.T) {
  21. convey.Convey("noticeKey", t, func(ctx convey.C) {
  22. var (
  23. mid = int64(0)
  24. )
  25. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  26. p1 := noticeKey(mid)
  27. ctx.Convey("Then p1 should not be nil.", func(ctx convey.C) {
  28. ctx.So(p1, convey.ShouldNotBeNil)
  29. })
  30. })
  31. })
  32. }
  33. func TestDaoRawNotice(t *testing.T) {
  34. convey.Convey("RawNotice", t, func(ctx convey.C) {
  35. var (
  36. c = context.Background()
  37. mid = int64(0)
  38. )
  39. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  40. res, err := d.RawNotice(c, mid)
  41. ctx.Convey("Then err should be nil.res should not be nil.", func(ctx convey.C) {
  42. ctx.So(err, convey.ShouldBeNil)
  43. ctx.So(res, convey.ShouldNotBeNil)
  44. })
  45. })
  46. })
  47. }
  48. func TestDaoSetNotice(t *testing.T) {
  49. convey.Convey("SetNotice", t, func(ctx convey.C) {
  50. var (
  51. c = context.Background()
  52. mid = int64(0)
  53. notice = ""
  54. )
  55. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  56. err := d.SetNotice(c, mid, notice)
  57. ctx.Convey("Then err should be nil.", func(ctx convey.C) {
  58. ctx.So(err, convey.ShouldBeNil)
  59. })
  60. })
  61. })
  62. }