Skip to content

Commit f2fa10c

Browse files
committed
test: verify remove_item triggers needs_rebuild
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
1 parent 8d3528d commit f2fa10c

File tree

2 files changed

+14
-131
lines changed

2 files changed

+14
-131
lines changed

COVERAGE_AUDIT.md

Lines changed: 0 additions & 131 deletions
This file was deleted.

test/lsi/lsi_test.rb

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,20 @@ def test_remove_nonexistent_item
188188
assert_equal 1, lsi.items.size, 'Should not affect index when removing nonexistent item'
189189
end
190190

191+
def test_remove_item_triggers_needs_rebuild
192+
lsi = Classifier::LSI.new auto_rebuild: false
193+
lsi.add_item @str1, 'Dog'
194+
lsi.add_item @str2, 'Dog'
195+
lsi.add_item @str3, 'Cat'
196+
lsi.build_index
197+
198+
refute lsi.needs_rebuild?, 'Index should be current after build'
199+
200+
lsi.remove_item @str1
201+
202+
assert lsi.needs_rebuild?, 'Index should need rebuild after removing item'
203+
end
204+
191205
def test_items_method
192206
lsi = Classifier::LSI.new
193207
lsi.add_item @str1, 'Dog'

0 commit comments

Comments
 (0)