Skip to content

Conversation

@Jasrags
Copy link
Contributor

@Jasrags Jasrags commented May 20, 2025

Description

Added generated tests to buffs and badinputtracker packages.

Changes

Provide a bullet point list of noteworthy changes in this Pull Request:

  • github.com/GoMudEngine/GoMud/internal/buffs 0.306s coverage: 25.8% of statements
  • github.com/GoMudEngine/GoMud/internal/badinputtracker 0.351s coverage: 100.0% of statements

@Jasrags Jasrags requested a review from Copilot May 20, 2025 14:54
@Jasrags Jasrags self-assigned this May 20, 2025
@Jasrags Jasrags requested a review from Volte6 as a code owner May 20, 2025 14:54
@Jasrags Jasrags added the enhancement New feature or request label May 20, 2025
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR introduces refactored logic in the buffs package and adds comprehensive unit tests for the badinputtracker package, improving test coverage for bad-input tracking.

  • Simplified clamping of RoundInterval in BuffSpec.GetValue and corrected a typo in the SearchBuffs comment.
  • Generated and added extensive tests for TrackBadCommand, GetBadCommands, and Clear in badinputtracker.

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
internal/buffs/buffspec.go Replace manual clamping with max helper; fix comment typo
internal/badinputtracker/badinputtracker_test.go Add generated tests covering all bad-input tracking behaviors
Comments suppressed due to low confidence (3)

internal/buffs/buffspec.go:98

  • The refactored GetValue logic (particularly negative RoundInterval handling) isn't covered by existing tests. Consider adding unit tests for edge cases like RoundInterval > 5 and RoundInterval == 5.
func (b *BuffSpec) GetValue() int {

internal/buffs/buffspec.go:151

  • The new SearchBuffs function lacks unit tests. Consider adding tests for trimming, case-insensitivity, and partial matches to validate its behavior.
func SearchBuffs(searchTerm string) []int {

internal/buffs/buffspec.go:99

  • The max function may be undefined in this context. Ensure you have a helper for integer max or inline equivalent logic to prevent an undefined identifier error.
freqVal := max(5-b.RoundInterval, 0)

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@Jasrags Jasrags merged commit b9476a3 into master May 21, 2025
6 checks passed
@Jasrags Jasrags deleted the buffs_badinputtracker_test_coverage branch May 21, 2025 16:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants