dao_test.go 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. package converge
  2. import (
  3. "context"
  4. "flag"
  5. "path/filepath"
  6. "reflect"
  7. "testing"
  8. "go-common/app/interface/main/app-card/model/card/operate"
  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_Cards(t *testing.T) {
  41. type args struct {
  42. c context.Context
  43. }
  44. tests := []struct {
  45. name string
  46. args args
  47. wantCm map[int64]*operate.Converge
  48. wantErr bool
  49. }{
  50. // TODO: Add test cases.
  51. }
  52. for _, tt := range tests {
  53. Convey(tt.name, t, func() {
  54. gotCm, err := d.Cards(tt.args.c)
  55. So(gotCm, ShouldEqual, tt.wantCm)
  56. So(err, ShouldEqual, tt.wantErr)
  57. })
  58. }
  59. }
  60. func TestDao_Close(t *testing.T) {
  61. tests := []struct {
  62. name string
  63. dao *Dao
  64. }{
  65. // TODO: Add test cases.
  66. }
  67. for _, tt := range tests {
  68. t.Run(tt.name, func(t *testing.T) {
  69. tt.dao.Close()
  70. })
  71. }
  72. }