dao_test.go 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. package article
  2. import (
  3. "context"
  4. "go-common/app/interface/main/app-feed/conf"
  5. article "go-common/app/interface/openplatform/article/model"
  6. "reflect"
  7. "testing"
  8. . "github.com/smartystreets/goconvey/convey"
  9. )
  10. func TestNew(t *testing.T) {
  11. type args struct {
  12. c *conf.Config
  13. }
  14. tests := []struct {
  15. name string
  16. args args
  17. wantD *Dao
  18. }{
  19. // TODO: Add test cases.
  20. }
  21. for _, tt := range tests {
  22. t.Run(tt.name, func(t *testing.T) {
  23. if gotD := New(tt.args.c); !reflect.DeepEqual(gotD, tt.wantD) {
  24. t.Errorf("New() = %v, want %v", gotD, tt.wantD)
  25. }
  26. })
  27. }
  28. Convey("new", t, func() {
  29. So(t, ShouldNotBeNil)
  30. })
  31. }
  32. func TestDao_Articles(t *testing.T) {
  33. type args struct {
  34. c context.Context
  35. aids []int64
  36. }
  37. tests := []struct {
  38. name string
  39. d *Dao
  40. args args
  41. wantMs map[int64]*article.Meta
  42. wantErr bool
  43. }{
  44. // TODO: Add test cases.
  45. }
  46. for _, tt := range tests {
  47. t.Run(tt.name, func(t *testing.T) {
  48. gotMs, err := tt.d.Articles(tt.args.c, tt.args.aids)
  49. if (err != nil) != tt.wantErr {
  50. t.Errorf("Dao.Articles() error = %v, wantErr %v", err, tt.wantErr)
  51. return
  52. }
  53. if !reflect.DeepEqual(gotMs, tt.wantMs) {
  54. t.Errorf("Dao.Articles() = %v, want %v", gotMs, tt.wantMs)
  55. }
  56. })
  57. }
  58. }