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,76 @@
package dao
import (
"context"
"go-common/app/job/main/growup/model"
"testing"
"time"
"github.com/smartystreets/goconvey/convey"
)
func TestDaoGetTotalExpenseByDate(t *testing.T) {
convey.Convey("GetTotalExpenseByDate", t, func(ctx convey.C) {
var (
c = context.Background()
date = "2018-06-23"
)
ctx.Convey("When everything goes positive", func(ctx convey.C) {
expense, err := d.GetTotalExpenseByDate(c, date)
ctx.Convey("Then err should be nil.expense should not be nil.", func(ctx convey.C) {
ctx.So(err, convey.ShouldBeNil)
ctx.So(expense, convey.ShouldNotBeNil)
})
})
})
}
func TestDaoInsertDailyExpense(t *testing.T) {
convey.Convey("InsertDailyExpense", t, func(ctx convey.C) {
var (
c = context.Background()
e = &model.BudgetExpense{
Expense: 100,
UpCount: 100,
AvCount: 100,
UpAvgExpense: 100,
AvAvgExpense: 100,
Date: time.Now(),
TotalExpense: 100,
CType: 1,
}
)
ctx.Convey("When everything goes positive", func(ctx convey.C) {
rows, err := d.InsertDailyExpense(c, e)
ctx.Convey("Then err should be nil.rows should not be nil.", func(ctx convey.C) {
ctx.So(err, convey.ShouldBeNil)
ctx.So(rows, convey.ShouldNotBeNil)
})
})
})
}
func TestDaoInsertMonthlyExpense(t *testing.T) {
convey.Convey("InsertMonthlyExpense", t, func(ctx convey.C) {
var (
c = context.Background()
e = &model.BudgetExpense{
Expense: 100,
UpCount: 100,
AvCount: 100,
UpAvgExpense: 100,
AvAvgExpense: 100,
Date: time.Now(),
TotalExpense: 100,
CType: 1,
}
)
ctx.Convey("When everything goes positive", func(ctx convey.C) {
rows, err := d.InsertMonthlyExpense(c, e)
ctx.Convey("Then err should be nil.rows should not be nil.", func(ctx convey.C) {
ctx.So(err, convey.ShouldBeNil)
ctx.So(rows, convey.ShouldNotBeNil)
})
})
})
}