Files
go-common/app/interface/main/app-feed/dao/audio/dao_test.go
2019-04-22 18:49:16 +08:00

68 lines
1.1 KiB
Go

package audio
import (
"context"
"flag"
"path/filepath"
"reflect"
"testing"
"go-common/app/interface/main/app-card/model/card/audio"
"go-common/app/interface/main/app-feed/conf"
. "github.com/smartystreets/goconvey/convey"
)
var (
d *Dao
)
func init() {
dir, _ := filepath.Abs("../../cmd/app-feed-test.toml")
flag.Set("conf", dir)
conf.Init()
d = New(conf.Conf)
}
func TestNew(t *testing.T) {
type args struct {
c *conf.Config
}
tests := []struct {
name string
args args
wantD *Dao
}{
// TODO: Add test cases.
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
if gotD := New(tt.args.c); !reflect.DeepEqual(gotD, tt.wantD) {
t.Errorf("New() = %v, want %v", gotD, tt.wantD)
}
})
}
}
func TestDao_Audios(t *testing.T) {
type args struct {
c context.Context
ids []int64
}
tests := []struct {
name string
args args
wantAum map[int64]*audio.Audio
wantErr bool
}{
// TODO: Add test cases.
}
for _, tt := range tests {
Convey(tt.name, t, func() {
gotAum, err := d.Audios(tt.args.c, tt.args.ids)
So(gotAum, ShouldEqual, tt.wantAum)
So(err, ShouldEqual, tt.wantErr)
})
}
}