Skip to content

Add test for remove_item triggering needs_rebuild#59

Merged
cardmagic merged 1 commit intomasterfrom
test/lsi-remove-item-rebuild
Dec 27, 2025
Merged

Add test for remove_item triggering needs_rebuild#59
cardmagic merged 1 commit intomasterfrom
test/lsi-remove-item-rebuild

Conversation

@cardmagic
Copy link
Owner

Summary

Add the final missing test for issue #51 - verifying that LSI#remove_item triggers needs_rebuild?.

Context

Most tests for remove_item and items were added in PR #58. This PR adds the one remaining test:

Test Added

def test_remove_item_triggers_needs_rebuild
  lsi = Classifier::LSI.new auto_rebuild: false
  lsi.add_item @str1, 'Dog'
  lsi.add_item @str2, 'Dog'
  lsi.add_item @str3, 'Cat'
  lsi.build_index

  refute lsi.needs_rebuild?, 'Index should be current after build'

  lsi.remove_item @str1

  assert lsi.needs_rebuild?, 'Index should need rebuild after removing item'
end

Fixes #51

@cardmagic cardmagic requested a review from Copilot December 27, 2025 06:39
@cardmagic cardmagic self-assigned this Dec 27, 2025
Copy link

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 adds a test to verify that LSI#remove_item triggers the needs_rebuild? flag, completing the test coverage for issue #51.

  • Adds test_remove_item_triggers_needs_rebuild to validate that removing an item sets the rebuild flag
  • Complements existing tests for remove_item functionality added in PR #58
  • Uses auto_rebuild: false to explicitly test the needs_rebuild? state changes

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Add missing test to confirm that LSI#remove_item properly
increments the version, causing needs_rebuild? to return true.

This completes the test coverage for issue #51 - the other
required tests were added in PR #58.

Fixes #51
@cardmagic cardmagic force-pushed the test/lsi-remove-item-rebuild branch from ed81727 to f2fa10c Compare December 27, 2025 06:39
@cardmagic cardmagic merged commit 8bff7c5 into master Dec 27, 2025
4 checks passed
@cardmagic cardmagic deleted the test/lsi-remove-item-rebuild branch December 27, 2025 06:41
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.

Add tests for LSI#remove_item and LSI#items methods

1 participant