feat: user buy media

This commit is contained in:
Rogee
2024-12-10 11:21:55 +08:00
parent 21840c3adf
commit e3ef31037c
17 changed files with 201 additions and 132 deletions

View File

@@ -11,6 +11,7 @@ import (
"backend/providers/postgres"
"backend/providers/storage"
log "github.com/sirupsen/logrus"
. "github.com/smartystreets/goconvey/convey"
"github.com/stretchr/testify/suite"
"go.uber.org/dig"
@@ -27,6 +28,7 @@ type ServiceTestSuite struct {
}
func Test_DiscoverMedias(t *testing.T) {
log.SetLevel(log.DebugLevel)
providers := testx.Default(
postgres.DefaultProvider(),
storage.DefaultProvider(),
@@ -66,3 +68,18 @@ func (t *ServiceTestSuite) Test_getMediaByHash() {
So(ext, ShouldEqual, "ts")
})
}
func (t *ServiceTestSuite) Test_GetUserBalance() {
Convey("Test_GetUserBalance", t.T(), func() {
balance, err := t.Svc.GetUserBalance(context.Background(), 1, 1)
So(err, ShouldBeNil)
t.T().Logf("balance: %+v", balance)
})
}
func (t *ServiceTestSuite) Test_Checkout() {
Convey("Test_Checkout", t.T(), func() {
err := t.Svc.Checkout(context.TODO(), 1, 1, 1)
So(err, ShouldBeNil)
})
}