dao_test.go 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. package game
  2. import (
  3. "context"
  4. "flag"
  5. "path/filepath"
  6. "reflect"
  7. "testing"
  8. "go-common/app/interface/main/app-view/conf"
  9. "go-common/app/interface/main/app-view/model/game"
  10. . "github.com/smartystreets/goconvey/convey"
  11. )
  12. var (
  13. d *Dao
  14. )
  15. func init() {
  16. dir, _ := filepath.Abs("../../cmd/app-view-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_Info(t *testing.T) {
  41. type args struct {
  42. c context.Context
  43. gameID int64
  44. plat int8
  45. }
  46. tests := []struct {
  47. name string
  48. args args
  49. wantInfo *game.Info
  50. wantErr bool
  51. }{
  52. // TODO: Add test cases.
  53. }
  54. for _, tt := range tests {
  55. Convey(tt.name, t, func() {
  56. gotInfo, err := d.Info(tt.args.c, tt.args.gameID, tt.args.plat)
  57. So(err, ShouldEqual, tt.wantErr)
  58. So(gotInfo, ShouldResemble, tt.wantInfo)
  59. })
  60. }
  61. }