dao_test.go 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. package live
  2. import (
  3. "context"
  4. "flag"
  5. "path/filepath"
  6. "reflect"
  7. "testing"
  8. "go-common/app/interface/main/app-card/model/card/live"
  9. "go-common/app/interface/main/app-feed/conf"
  10. model "go-common/app/interface/main/app-feed/model/live"
  11. . "github.com/smartystreets/goconvey/convey"
  12. )
  13. var (
  14. d *Dao
  15. )
  16. func init() {
  17. dir, _ := filepath.Abs("../../cmd/app-feed-test.toml")
  18. flag.Set("conf", dir)
  19. conf.Init()
  20. d = New(conf.Conf)
  21. }
  22. func TestNew(t *testing.T) {
  23. type args struct {
  24. c *conf.Config
  25. }
  26. tests := []struct {
  27. name string
  28. args args
  29. wantD *Dao
  30. }{
  31. // TODO: Add test cases.
  32. }
  33. for _, tt := range tests {
  34. t.Run(tt.name, func(t *testing.T) {
  35. if gotD := New(tt.args.c); !reflect.DeepEqual(gotD, tt.wantD) {
  36. t.Errorf("New() = %v, want %v", gotD, tt.wantD)
  37. }
  38. })
  39. }
  40. }
  41. func TestDao_AppMRoom(t *testing.T) {
  42. type args struct {
  43. c context.Context
  44. roomids []int64
  45. }
  46. tests := []struct {
  47. name string
  48. args args
  49. wantRs map[int64]*live.Room
  50. wantErr error
  51. }{
  52. // TODO: Add test cases.
  53. }
  54. for _, tt := range tests {
  55. Convey(tt.name, t, func() {
  56. gotRs, err := d.AppMRoom(tt.args.c, tt.args.roomids)
  57. So(gotRs, ShouldEqual, tt.wantRs)
  58. So(err, ShouldEqual, tt.wantErr)
  59. })
  60. }
  61. }
  62. func TestDao_FeedList(t *testing.T) {
  63. type args struct {
  64. c context.Context
  65. mid int64
  66. pn int
  67. ps int
  68. }
  69. tests := []struct {
  70. name string
  71. args args
  72. wantFs []*model.Feed
  73. wantCount int
  74. wantErr bool
  75. }{
  76. // TODO: Add test cases.
  77. }
  78. for _, tt := range tests {
  79. Convey(tt.name, t, func() {
  80. gotFs, gotCount, err := d.FeedList(tt.args.c, tt.args.mid, tt.args.pn, tt.args.ps)
  81. So(gotFs, ShouldEqual, tt.wantFs)
  82. So(gotCount, ShouldEqual, tt.wantCount)
  83. So(err, ShouldEqual, tt.wantErr)
  84. })
  85. }
  86. }