upper_test.go 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. package archive
  2. import (
  3. "context"
  4. "testing"
  5. "github.com/smartystreets/goconvey/convey"
  6. )
  7. func TestArchiveUppersCount(t *testing.T) {
  8. var (
  9. c = context.TODO()
  10. mids = []int64{1, 2}
  11. )
  12. convey.Convey("UppersCount", t, func(ctx convey.C) {
  13. uc, err := d.UppersCount(c, mids)
  14. ctx.Convey("Then err should be nil.uc should not be nil.", func(ctx convey.C) {
  15. ctx.So(err, convey.ShouldBeNil)
  16. ctx.So(uc, convey.ShouldNotBeNil)
  17. })
  18. })
  19. }
  20. func TestArchiveUpperCount(t *testing.T) {
  21. var (
  22. c = context.TODO()
  23. mid = int64(1)
  24. )
  25. convey.Convey("UpperCount", t, func(ctx convey.C) {
  26. count, err := d.UpperCount(c, mid)
  27. ctx.Convey("Then err should be nil.count should not be nil.", func(ctx convey.C) {
  28. ctx.So(err, convey.ShouldBeNil)
  29. ctx.So(count, convey.ShouldNotBeNil)
  30. })
  31. })
  32. }
  33. func TestArchiveUpperPassed(t *testing.T) {
  34. var (
  35. c = context.TODO()
  36. mid = int64(1)
  37. )
  38. convey.Convey("UpperPassed", t, func(ctx convey.C) {
  39. _, _, _, err := d.UpperPassed(c, mid)
  40. ctx.Convey("Then err should be nil.", func(ctx convey.C) {
  41. ctx.So(err, convey.ShouldBeNil)
  42. })
  43. })
  44. }
  45. func TestArchiveUppersPassed(t *testing.T) {
  46. var (
  47. c = context.TODO()
  48. mids = []int64{1}
  49. )
  50. convey.Convey("UppersPassed", t, func(ctx convey.C) {
  51. aidm, ptimes, copyrights, err := d.UppersPassed(c, mids)
  52. ctx.Convey("Then err should be nil.aidm,ptimes,copyrights should not be nil.", func(ctx convey.C) {
  53. ctx.So(err, convey.ShouldBeNil)
  54. ctx.So(copyrights, convey.ShouldNotBeNil)
  55. ctx.So(ptimes, convey.ShouldNotBeNil)
  56. ctx.So(aidm, convey.ShouldNotBeNil)
  57. })
  58. })
  59. }