dao_test.go 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. package ai
  2. import (
  3. "context"
  4. "flag"
  5. "path/filepath"
  6. "reflect"
  7. "testing"
  8. "go-common/app/interface/main/app-view/conf"
  9. . "github.com/smartystreets/goconvey/convey"
  10. )
  11. var (
  12. d *Dao
  13. )
  14. func init() {
  15. dir, _ := filepath.Abs("../../cmd/app-view-test.toml")
  16. flag.Set("conf", dir)
  17. conf.Init()
  18. d = New(conf.Conf)
  19. }
  20. func TestNew(t *testing.T) {
  21. type args struct {
  22. c *conf.Config
  23. }
  24. tests := []struct {
  25. name string
  26. args args
  27. wantD *Dao
  28. }{
  29. // TODO: Add test cases.
  30. }
  31. for _, tt := range tests {
  32. t.Run(tt.name, func(t *testing.T) {
  33. if gotD := New(tt.args.c); !reflect.DeepEqual(gotD, tt.wantD) {
  34. t.Errorf("New() = %v, want %v", gotD, tt.wantD)
  35. }
  36. })
  37. }
  38. }
  39. func TestDao_Av2Game(t *testing.T) {
  40. type args struct {
  41. c context.Context
  42. }
  43. tests := []struct {
  44. name string
  45. args args
  46. wantRes map[int64]int64
  47. wantErr bool
  48. }{
  49. // TODO: Add test cases.
  50. }
  51. for _, tt := range tests {
  52. Convey(tt.name, t, func() {
  53. gotRes, err := d.Av2Game(tt.args.c)
  54. So(err, ShouldEqual, tt.wantErr)
  55. So(gotRes, ShouldResemble, tt.wantRes)
  56. })
  57. }
  58. }