dao_test.go 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. package relation
  2. import (
  3. . "github.com/smartystreets/goconvey/convey"
  4. "context"
  5. "reflect"
  6. "testing"
  7. "go-common/app/interface/main/app-feed/conf"
  8. relation "go-common/app/service/main/relation/model"
  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. Convey(tt.name, t, func() {
  23. gotD := New(tt.args.c)
  24. So(gotD, ShouldEqual, tt.wantD)
  25. })
  26. }
  27. }
  28. func TestDao_Stats(t *testing.T) {
  29. type args struct {
  30. ctx context.Context
  31. mids []int64
  32. }
  33. tests := []struct {
  34. name string
  35. d *Dao
  36. args args
  37. wantRes map[int64]*relation.Stat
  38. wantErr bool
  39. }{
  40. // TODO: Add test cases.
  41. }
  42. for _, tt := range tests {
  43. t.Run(tt.name, func(t *testing.T) {
  44. gotRes, err := tt.d.Stats(tt.args.ctx, tt.args.mids)
  45. if (err != nil) != tt.wantErr {
  46. t.Errorf("Dao.Stats() error = %v, wantErr %v", err, tt.wantErr)
  47. return
  48. }
  49. if !reflect.DeepEqual(gotRes, tt.wantRes) {
  50. t.Errorf("Dao.Stats() = %v, want %v", gotRes, tt.wantRes)
  51. }
  52. })
  53. }
  54. }