test: add comprehensive tests to improve coverage#240
Closed
Conversation
Agent-Logs-Url: https://github.com/SyntaxNyah/Nyathena/sessions/2e7609fa-03c7-4f10-877a-ef28fabe8911 Co-authored-by: SyntaxNyah <235356625+SyntaxNyah@users.noreply.github.com>
Copilot created this pull request from a session on behalf of
SyntaxNyah
April 5, 2026 16:21
View session
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Analyzes and improves test coverage across the codebase. Before this PR, overall statement coverage was 10.5% with 6 packages at 0%.
Changes
Bug fix
internal/athena/pos_test.go— Corrected a wrong test expectation: the test expected/123to not matchcommandRegex, but the regex (^/[a-z0-9]+(-[a-z0-9]+)*) and its own code comment explicitly allow numeric commands like/51. This caused a pre-existing test failure.New test files
internal/sliceutil/sliceutil_test.gointernal/permissions/permissions_test.gointernal/packet/packet_test.gointernal/playercount/playercount_test.gointernal/uidheap/uidheap_test.gointernal/webhook/webhook_extra_test.gointernal/area/area_extra_test.gointernal/settings/settings_test.goWhat each test file covers
ContainsString/ContainsIntwith found, not-found, empty, nil, and edge-value casesGetPermissions(empty, single, multi-perm, admin),HasPermission(exact, superset, missing, admin),IsModerator(no-perm, CM-only, kick, admin)NewPacket(header-only, with body, trailing-#stripping, empty/whitespace header errors),String(no body, with body, empty field), roundtrip through network-layer strippingGetPlayerCount,AddPlayer,RemovePlayer, symmetric add/remove, concurrent add/remove with-racePush/Pop,Less,Swap,Len, min-heap ordering verification"N/A"renderingDefaultConfigfield spot-checks,LoadFilesuccess/missing/empty,GetConfigwith TOML overrides and missing fileOverall coverage: 10.5% → 12.5%
All tests pass with
-race.