Fix: 테스트 코드 콜백 시그니처 업데이트 (rewardGrant → txID 반환)
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -226,8 +226,8 @@ func TestNewService_NilParams(t *testing.T) {
|
||||
|
||||
func TestSetRewardGranter(t *testing.T) {
|
||||
svc := NewService(nil, nil)
|
||||
svc.SetRewardGranter(func(username string, tokenAmount uint64, assets []core.MintAssetPayload) error {
|
||||
return nil
|
||||
svc.SetRewardGranter(func(username string, tokenAmount uint64, assets []core.MintAssetPayload) (string, error) {
|
||||
return "", nil
|
||||
})
|
||||
if svc.rewardGrant == nil {
|
||||
t.Error("rewardGrant should be set after SetRewardGranter")
|
||||
@@ -281,7 +281,7 @@ func newMockRepo() *mockRepo {
|
||||
// This lets us test business rules without external dependencies.
|
||||
type testableService struct {
|
||||
repo *mockRepo
|
||||
rewardGrant func(username string, tokenAmount uint64, assets []core.MintAssetPayload) error
|
||||
rewardGrant func(username string, tokenAmount uint64, assets []core.MintAssetPayload) (string, error)
|
||||
}
|
||||
|
||||
func (s *testableService) requestEntry(usernames []string, bossID int) (*BossRoom, error) {
|
||||
@@ -351,7 +351,7 @@ func (s *testableService) completeRaid(sessionName string, rewards []PlayerRewar
|
||||
var results []RewardResult
|
||||
if s.rewardGrant != nil {
|
||||
for _, r := range rewards {
|
||||
grantErr := s.rewardGrant(r.Username, r.TokenAmount, r.Assets)
|
||||
_, grantErr := s.rewardGrant(r.Username, r.TokenAmount, r.Assets)
|
||||
res := RewardResult{Username: r.Username, Success: grantErr == nil}
|
||||
if grantErr != nil {
|
||||
res.Error = grantErr.Error()
|
||||
@@ -453,9 +453,9 @@ func TestMock_CompleteRaid_WithRewardGranter(t *testing.T) {
|
||||
grantCalls := 0
|
||||
svc := &testableService{
|
||||
repo: newMockRepo(),
|
||||
rewardGrant: func(username string, tokenAmount uint64, assets []core.MintAssetPayload) error {
|
||||
rewardGrant: func(username string, tokenAmount uint64, assets []core.MintAssetPayload) (string, error) {
|
||||
grantCalls++
|
||||
return nil
|
||||
return "", nil
|
||||
},
|
||||
}
|
||||
room, _ := svc.requestEntry([]string{"p1"}, 1)
|
||||
@@ -478,8 +478,8 @@ func TestMock_CompleteRaid_WithRewardGranter(t *testing.T) {
|
||||
func TestMock_CompleteRaid_RewardFailure(t *testing.T) {
|
||||
svc := &testableService{
|
||||
repo: newMockRepo(),
|
||||
rewardGrant: func(username string, tokenAmount uint64, assets []core.MintAssetPayload) error {
|
||||
return fmt.Errorf("chain error")
|
||||
rewardGrant: func(username string, tokenAmount uint64, assets []core.MintAssetPayload) (string, error) {
|
||||
return "", fmt.Errorf("chain error")
|
||||
},
|
||||
}
|
||||
room, _ := svc.requestEntry([]string{"p1"}, 1)
|
||||
|
||||
Reference in New Issue
Block a user