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) {
|
func TestSetRewardGranter(t *testing.T) {
|
||||||
svc := NewService(nil, nil)
|
svc := NewService(nil, nil)
|
||||||
svc.SetRewardGranter(func(username string, tokenAmount uint64, assets []core.MintAssetPayload) error {
|
svc.SetRewardGranter(func(username string, tokenAmount uint64, assets []core.MintAssetPayload) (string, error) {
|
||||||
return nil
|
return "", nil
|
||||||
})
|
})
|
||||||
if svc.rewardGrant == nil {
|
if svc.rewardGrant == nil {
|
||||||
t.Error("rewardGrant should be set after SetRewardGranter")
|
t.Error("rewardGrant should be set after SetRewardGranter")
|
||||||
@@ -281,7 +281,7 @@ func newMockRepo() *mockRepo {
|
|||||||
// This lets us test business rules without external dependencies.
|
// This lets us test business rules without external dependencies.
|
||||||
type testableService struct {
|
type testableService struct {
|
||||||
repo *mockRepo
|
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) {
|
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
|
var results []RewardResult
|
||||||
if s.rewardGrant != nil {
|
if s.rewardGrant != nil {
|
||||||
for _, r := range rewards {
|
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}
|
res := RewardResult{Username: r.Username, Success: grantErr == nil}
|
||||||
if grantErr != nil {
|
if grantErr != nil {
|
||||||
res.Error = grantErr.Error()
|
res.Error = grantErr.Error()
|
||||||
@@ -453,9 +453,9 @@ func TestMock_CompleteRaid_WithRewardGranter(t *testing.T) {
|
|||||||
grantCalls := 0
|
grantCalls := 0
|
||||||
svc := &testableService{
|
svc := &testableService{
|
||||||
repo: newMockRepo(),
|
repo: newMockRepo(),
|
||||||
rewardGrant: func(username string, tokenAmount uint64, assets []core.MintAssetPayload) error {
|
rewardGrant: func(username string, tokenAmount uint64, assets []core.MintAssetPayload) (string, error) {
|
||||||
grantCalls++
|
grantCalls++
|
||||||
return nil
|
return "", nil
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
room, _ := svc.requestEntry([]string{"p1"}, 1)
|
room, _ := svc.requestEntry([]string{"p1"}, 1)
|
||||||
@@ -478,8 +478,8 @@ func TestMock_CompleteRaid_WithRewardGranter(t *testing.T) {
|
|||||||
func TestMock_CompleteRaid_RewardFailure(t *testing.T) {
|
func TestMock_CompleteRaid_RewardFailure(t *testing.T) {
|
||||||
svc := &testableService{
|
svc := &testableService{
|
||||||
repo: newMockRepo(),
|
repo: newMockRepo(),
|
||||||
rewardGrant: func(username string, tokenAmount uint64, assets []core.MintAssetPayload) error {
|
rewardGrant: func(username string, tokenAmount uint64, assets []core.MintAssetPayload) (string, error) {
|
||||||
return fmt.Errorf("chain error")
|
return "", fmt.Errorf("chain error")
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
room, _ := svc.requestEntry([]string{"p1"}, 1)
|
room, _ := svc.requestEntry([]string{"p1"}, 1)
|
||||||
|
|||||||
Reference in New Issue
Block a user