dao_test.go 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. package rank
  2. import (
  3. "context"
  4. "flag"
  5. "path/filepath"
  6. "reflect"
  7. "testing"
  8. "go-common/app/interface/main/app-card/model/card/rank"
  9. "go-common/app/interface/main/app-feed/conf"
  10. . "github.com/smartystreets/goconvey/convey"
  11. )
  12. var (
  13. d *Dao
  14. )
  15. func init() {
  16. dir, _ := filepath.Abs("../../cmd/app-feed-test.toml")
  17. flag.Set("conf", dir)
  18. conf.Init()
  19. d = New(conf.Conf)
  20. }
  21. func TestNew(t *testing.T) {
  22. type args struct {
  23. c *conf.Config
  24. }
  25. tests := []struct {
  26. name string
  27. args args
  28. wantD *Dao
  29. }{
  30. // TODO: Add test cases.
  31. }
  32. for _, tt := range tests {
  33. t.Run(tt.name, func(t *testing.T) {
  34. if gotD := New(tt.args.c); !reflect.DeepEqual(gotD, tt.wantD) {
  35. t.Errorf("New() = %v, want %v", gotD, tt.wantD)
  36. }
  37. })
  38. }
  39. }
  40. func TestDao_AllRank(t *testing.T) {
  41. type args struct {
  42. c context.Context
  43. }
  44. tests := []struct {
  45. name string
  46. args args
  47. wantRanks []rank.Rank
  48. wantErr error
  49. }{
  50. // TODO: Add test cases.
  51. }
  52. for _, tt := range tests {
  53. Convey(tt.name, t, func() {
  54. gotRanks, err := d.AllRank(tt.args.c)
  55. So(gotRanks, ShouldEqual, tt.wantRanks)
  56. So(err, ShouldEqual, tt.wantErr)
  57. })
  58. }
  59. }