feat: add orders
This commit is contained in:
47
backend/app/models/orders_test.go
Normal file
47
backend/app/models/orders_test.go
Normal file
@@ -0,0 +1,47 @@
|
||||
package models
|
||||
|
||||
import (
|
||||
"context"
|
||||
"testing"
|
||||
|
||||
"quyun/app/service/testx"
|
||||
"quyun/database"
|
||||
"quyun/database/schemas/public/table"
|
||||
|
||||
. "github.com/smartystreets/goconvey/convey"
|
||||
"go.ipao.vip/atom/contracts"
|
||||
|
||||
// . "github.com/go-jet/jet/v2/postgres"
|
||||
"github.com/stretchr/testify/suite"
|
||||
"go.uber.org/dig"
|
||||
)
|
||||
|
||||
type OrdersInjectParams struct {
|
||||
dig.In
|
||||
Initials []contracts.Initial `group:"initials"`
|
||||
}
|
||||
|
||||
type OrdersTestSuite struct {
|
||||
suite.Suite
|
||||
|
||||
OrdersInjectParams
|
||||
}
|
||||
|
||||
func Test_Orders(t *testing.T) {
|
||||
providers := testx.Default().With(Provide)
|
||||
testx.Serve(providers, t, func(params OrdersInjectParams) {
|
||||
suite.Run(t, &OrdersTestSuite{
|
||||
OrdersInjectParams: params,
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
func (s *OrdersTestSuite) Test_Create() {
|
||||
Convey("Test_Create", s.T(), func() {
|
||||
database.Truncate(context.Background(), db, table.Orders.TableName())
|
||||
|
||||
order, err := Orders.Create(context.Background(), 1, 1)
|
||||
So(err, ShouldBeNil)
|
||||
s.T().Logf("order: %v", order)
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user