dao.cache_test.go 864 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. package dao
  2. import (
  3. "context"
  4. "testing"
  5. "github.com/smartystreets/goconvey/convey"
  6. )
  7. func TestDaoUserCoin(t *testing.T) {
  8. var (
  9. c = context.TODO()
  10. id = int64(123)
  11. )
  12. convey.Convey("UserCoin", t, func(ctx convey.C) {
  13. res, err := d.UserCoin(c, id)
  14. ctx.Convey("Error should be nil", func(ctx convey.C) {
  15. ctx.So(err, convey.ShouldBeNil)
  16. })
  17. ctx.Convey("res should not be nil", func(ctx convey.C) {
  18. ctx.So(res, convey.ShouldNotBeNil)
  19. })
  20. })
  21. }
  22. func TestDaoItemCoin(t *testing.T) {
  23. var (
  24. c = context.TODO()
  25. id = int64(123)
  26. tp = int64(60)
  27. )
  28. convey.Convey("ItemCoin", t, func(ctx convey.C) {
  29. res, err := d.ItemCoin(c, id, tp)
  30. ctx.Convey("Error should be nil", func(ctx convey.C) {
  31. ctx.So(err, convey.ShouldBeNil)
  32. })
  33. ctx.Convey("res should not be nil", func(ctx convey.C) {
  34. ctx.So(res, convey.ShouldNotBeNil)
  35. })
  36. })
  37. }