Skip to content

Implement core bot architecture and add comprehensive tests#19

Merged
arumes31 merged 4 commits into
mainfrom
v2_test
Jun 7, 2026
Merged

Implement core bot architecture and add comprehensive tests#19
arumes31 merged 4 commits into
mainfrom
v2_test

Conversation

@arumes31
Copy link
Copy Markdown
Owner

@arumes31 arumes31 commented Jun 7, 2026

Summary by CodeRabbit

  • Style

    • Updated TeamSpeak message labels and loot display formatting for consistency (standardized abbreviations and tag notation).
  • Tests

    • Significantly expanded unit test coverage across bot, database, games, and client-query modules with improved test patterns.

@arumes31 arumes31 merged commit 7b62d13 into main Jun 7, 2026
7 checks passed
@arumes31 arumes31 deleted the v2_test branch June 7, 2026 19:21
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Jun 7, 2026

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 04fce802-fbad-472f-aa31-a76b174fc0db

📥 Commits

Reviewing files that changed from the base of the PR and between 40e3805 and 81bd136.

📒 Files selected for processing (13)
  • internal/bot/auction_test.go
  • internal/bot/bot.go
  • internal/bot/bot_extra_test.go
  • internal/bot/bot_test.go
  • internal/bot/xp.go
  • internal/bot/xp_test.go
  • internal/clientquery/clientquery_extra_test.go
  • internal/clientquery/clientquery_test.go
  • internal/clientquery/commands_test.go
  • internal/db/db_test.go
  • internal/games/games_test.go
  • internal/games/sources.go
  • internal/icons/icons_test.go

📝 Walkthrough

Walkthrough

This PR adds comprehensive unit and integration test coverage across five modules (bot, clientquery, games, database, icons) while normalizing text formatting in bot and XP output strings—changing GS to gs, dura to dur, and slot: to s:—plus improving Reddit title suffix stripping logic with iterative matching.

Changes

Test Suite Expansion and Text Formatting Normalization

Layer / File(s) Summary
Bot module: text normalization and database test coverage
internal/bot/bot.go, internal/bot/auction_test.go, internal/bot/bot_extra_test.go, internal/bot/bot_test.go
Gear score label normalized from GS to gs in composePM and channel descriptions; durability label shortened from dura to dur in test input; bot test extended with sqlmock expectations for touchUser and CleanupDeadUsers database operations including session timestamps and user cleanup deletions.
XP module: loot/status text formatting and unit tests
internal/bot/xp.go, internal/bot/xp_test.go
Artifact and gear loot output text updated to use abbreviated labels—durability changed to dur, slot tags changed from slot: to s:, and score label changed from GS: to gs:—without changing XP calculation logic. Three new sqlmock unit tests validate computeMiscMult multiplier threshold, awardXP XP/level updates, and updateStreak increment behavior.
ClientQuery module: protocol parsing and integration tests
internal/clientquery/clientquery_test.go, internal/clientquery/clientquery_extra_test.go, internal/clientquery/commands_test.go
Five unit tests validate escaping/unescaping, word/error/key-value parsing with table-driven cases covering special characters and whitespace. Two integration tests exercise Command success/failure and Auth flows via mock TCP servers. Comprehensive TestCommands validates multiple client command methods against a listening TCP server with canned protocol responses.
Games module: test refactoring and Reddit title normalization
internal/games/games_test.go, internal/games/sources.go
Test suite refactored from mixed assertions into isolated table-driven tests for DisplayTitle, Key, isActive, FmtCents, CleanRedditTitle, and RedditDRM; MatchesDRM and PriceEUR tests expanded to cover platform and currency matrices. cleanRedditTitle updated to iteratively strip stacked giveaway suffixes until no matches remain, replacing single-pass suffix trimming.
Database migration and icons color tests
internal/db/db_test.go, internal/icons/icons_test.go
New TestMigrate validates golang-migrate driver initialization and migration table setup via sqlmock. New TestIsLight validates isLight color brightness helper for white (true) and black (false) RGB values.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Poem

🐰 Hops through test files, tail held high,
MockSQL gardens, TCP skies,
Labels now shorter—gs and s shine,
Assertions bloom, coverage divine! 🌱

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch v2_test

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant