You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
696 B
26 lines
696 B
package service |
|
|
|
import ( |
|
"context" |
|
"testing" |
|
|
|
coin "go-common/app/service/main/coin/api/gorpc" |
|
coinMdl "go-common/app/service/main/coin/model" |
|
|
|
"github.com/golang/mock/gomock" |
|
. "github.com/smartystreets/goconvey/convey" |
|
) |
|
|
|
func Test_Coin(t *testing.T) { |
|
mid := int64(1) |
|
aid := int64(1) |
|
Convey("get data", t, WithMock(t, func(mockCtrl *gomock.Controller) { |
|
mock := coin.NewMockRPC(mockCtrl) |
|
s.coinRPC = mock |
|
arg := &coinMdl.ArgCoinInfo{Mid: mid, Aid: aid, AvType: 2} |
|
mock.EXPECT().ArchiveUserCoins(gomock.Any(), arg).Return(&coinMdl.ArchiveUserCoins{Multiply: 10}, nil) |
|
res, err := s.Coin(context.TODO(), mid, aid, "") |
|
So(err, ShouldBeNil) |
|
So(res, ShouldEqual, 10) |
|
})) |
|
}
|
|
|