Initial commit

This commit is contained in:
Donny
2019-04-22 20:46:32 +08:00
commit 49ab8aadd1
25441 changed files with 4055000 additions and 0 deletions

View File

@@ -0,0 +1,56 @@
package dao
import (
"context"
"testing"
"github.com/smartystreets/goconvey/convey"
)
func TestDaoAccounts(t *testing.T) {
convey.Convey("Accounts", t, func(convCtx convey.C) {
var (
c = context.Background()
mids = []int64{1, 2}
)
convCtx.Convey("When everything goes positive", func(convCtx convey.C) {
accs, errs, err := d.Accounts(c, mids)
if err != nil {
convCtx.Convey("When no rows int result", func(convCtx convey.C) {
convCtx.So(err, convey.ShouldNotBeNil)
convCtx.So(errs, convey.ShouldNotBeNil)
convCtx.So(accs, convey.ShouldNotBeNil)
})
} else {
convCtx.Convey("When have rows int result", func(convCtx convey.C) {
convCtx.So(err, convey.ShouldBeNil)
convCtx.So(errs, convey.ShouldNotBeNil)
convCtx.So(accs, convey.ShouldNotBeNil)
})
}
})
})
}
func TestDaoName(t *testing.T) {
convey.Convey("Name", t, func(convCtx convey.C) {
var (
c = context.Background()
mid = int64(1)
)
convCtx.Convey("Name search two situation:", func(convCtx convey.C) {
name, err := d.Name(c, mid)
if err != nil {
convCtx.Convey("Name occur an error", func(convCtx convey.C) {
convCtx.So(err, convey.ShouldNotBeNil)
convCtx.So(name, convey.ShouldNotBeNil)
})
} else {
convCtx.Convey("Name no err search", func(convCtx convey.C) {
convCtx.So(err, convey.ShouldBeNil)
convCtx.So(name, convey.ShouldNotBeNil)
})
}
})
})
}