This document contains the test results for the bounty bot commands implementation (Issue #33).
Tests verify that the parseBountyCommand function correctly identifies and parses:
/bounty <amount> <currency>- Allocation commands/bounty- Request commands@roxonn bounty <amount> <currency>- Alternative allocation format@roxonn bounty- Alternative request format- Case-insensitive parsing
- Invalid command rejection
Test Cases:
- ✅
/bounty 10 XDC→ Allocation with XDC - ✅
/bounty 10.5 ROXN→ Allocation with decimal amount - ✅
/bounty→ Request without amount - ✅
@roxonn bounty 25 USDC→ Alternative format with USDC - ✅
@roxonn bounty→ Alternative request format - ✅ Case-insensitive parsing (
/Bounty 5 xdc) - ✅ Invalid currency rejection
- ✅ Invalid amount rejection (too large, negative)
Tests verify correct decimal handling for different currencies:
- XDC: 18 decimals
- ROXN: 18 decimals
- USDC: 6 decimals
Test Cases:
- ✅ XDC amount parsing and formatting
- ✅ USDC amount parsing and formatting
- ✅ Pool balance comparison logic
Tests verify blockchain method signatures and integration:
- ✅
allocateIssueRewardmethod exists and accepts correct parameters - ✅
getRepositorymethod exists and returns correct structure - ✅ Method parameter validation
Method Signatures Verified:
allocateIssueReward(
repoId: number,
issueId: number,
reward: string,
currencyType: 'XDC' | 'ROXN' | 'USDC',
userId: number
): Promise<AllocateRewardResponse>
getRepository(repoId: number): Promise<UnifiedPoolInfo>Tests verify the bounty request flow:
- ✅ Repository registration check
- ✅ Rate limiting (1 minute per issue)
- ✅ Bounty request creation
- ✅ Error handling for unregistered repositories
Tests verify the bounty allocation flow:
- ✅ Pool manager authorization check
- ✅ Pool balance verification
- ✅ Blockchain allocation call
- ✅ Success message posting
- ✅ Error handling for insufficient funds
- ✅ Error handling for unauthorized users
Tests verify edge case handling:
- ✅ Missing payload fields
- ✅ Invalid repository format (SSRF protection)
- ✅ Blockchain connection errors
- ✅ Invalid repository IDs
- ✅
issue_commentevent handling inserver/routes.ts - ✅ Command parsing from comment body
- ✅ GitHub API comment posting
- ✅
bountyRequeststable schema - ✅ Storage methods:
createBountyRequest,getBountyRequestsByIssue - ✅ Rate limiting using database queries
- ✅
allocateIssueRewardmethod call with correct parameters - ✅
getRepositorymethod call for pool balance checks - ✅ Currency type handling (XDC, ROXN, USDC)
- ✅ Decimal precision handling (18 for XDC/ROXN, 6 for USDC)
- ✅ SSRF protection for repository names
- ✅ Pool manager authorization (on-chain verification)
- ✅ Repository registration verification
- ✅ Rate limiting (1 minute per issue)
- ✅ Input validation (amount, currency)
Run tests with:
npx tsx scripts/test-bounty-bot.tsOr run individual test suites:
npm run test:bounty-bot
npm run test:blockchain-
Manual Testing on Test Repository:
- Set up a test GitHub repository
- Install the GitHub App
- Test commands in real issue comments
- Verify webhook delivery
-
Blockchain Testing:
- Test on testnet first
- Verify transaction execution
- Check gas estimation
- Verify pool balance updates
-
Integration Testing:
- Test full flow from comment to blockchain
- Verify database persistence
- Test error recovery
- Tests use mocks for blockchain and storage
- Real webhook testing requires GitHub App setup
- Blockchain testing requires testnet access