mysql_test.go 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. package stat
  2. import (
  3. "context"
  4. "testing"
  5. "github.com/smartystreets/goconvey/convey"
  6. )
  7. func TestStatUpdateFav(t *testing.T) {
  8. convey.Convey("UpdateFav", t, func(convCtx convey.C) {
  9. var (
  10. c = context.Background()
  11. oid = int64(111)
  12. count = int64(1)
  13. )
  14. convCtx.Convey("When everything goes positive", func(convCtx convey.C) {
  15. rows, err := d.UpdateFav(c, oid, count)
  16. convCtx.Convey("Then err should be nil.rows should not be nil.", func(convCtx convey.C) {
  17. convCtx.So(err, convey.ShouldBeNil)
  18. convCtx.So(rows, convey.ShouldNotBeNil)
  19. })
  20. })
  21. })
  22. }
  23. func TestStatUpdateShare(t *testing.T) {
  24. convey.Convey("UpdateShare", t, func(convCtx convey.C) {
  25. var (
  26. c = context.Background()
  27. oid = int64(111)
  28. count = int64(1)
  29. )
  30. convCtx.Convey("When everything goes positive", func(convCtx convey.C) {
  31. rows, err := d.UpdateShare(c, oid, count)
  32. convCtx.Convey("Then err should be nil.rows should not be nil.", func(convCtx convey.C) {
  33. convCtx.So(err, convey.ShouldBeNil)
  34. convCtx.So(rows, convey.ShouldNotBeNil)
  35. })
  36. })
  37. })
  38. }
  39. func TestStatUpdatePlay(t *testing.T) {
  40. convey.Convey("UpdatePlay", t, func(convCtx convey.C) {
  41. var (
  42. c = context.Background()
  43. oid = int64(111)
  44. count = int64(1)
  45. )
  46. convCtx.Convey("When everything goes positive", func(convCtx convey.C) {
  47. rows, err := d.UpdatePlay(c, oid, count)
  48. convCtx.Convey("Then err should be nil.rows should not be nil.", func(convCtx convey.C) {
  49. convCtx.So(err, convey.ShouldBeNil)
  50. convCtx.So(rows, convey.ShouldNotBeNil)
  51. })
  52. })
  53. })
  54. }
  55. func TestStatStat(t *testing.T) {
  56. convey.Convey("Stat", t, func(convCtx convey.C) {
  57. var (
  58. c = context.Background()
  59. oid = int64(111)
  60. )
  61. convCtx.Convey("When everything goes positive", func(convCtx convey.C) {
  62. f, err := d.Stat(c, oid)
  63. convCtx.Convey("Then err should be nil.f should not be nil.", func(convCtx convey.C) {
  64. convCtx.So(err, convey.ShouldBeNil)
  65. convCtx.So(f, convey.ShouldNotBeNil)
  66. })
  67. })
  68. })
  69. }