dao_test.go 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. package audio
  2. import (
  3. "context"
  4. "flag"
  5. "path/filepath"
  6. "reflect"
  7. "testing"
  8. "go-common/app/interface/main/app-card/model/card/audio"
  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_Audios(t *testing.T) {
  41. type args struct {
  42. c context.Context
  43. ids []int64
  44. }
  45. tests := []struct {
  46. name string
  47. args args
  48. wantAum map[int64]*audio.Audio
  49. wantErr bool
  50. }{
  51. // TODO: Add test cases.
  52. }
  53. for _, tt := range tests {
  54. Convey(tt.name, t, func() {
  55. gotAum, err := d.Audios(tt.args.c, tt.args.ids)
  56. So(gotAum, ShouldEqual, tt.wantAum)
  57. So(err, ShouldEqual, tt.wantErr)
  58. })
  59. }
  60. }