Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/store.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ function remove(id) {

// Returns the notes that match `term`.
function matches(notes, term) {
return notes.filter((note) => note.text === term);
return notes.filter((note) => note.text.includes(term));
}

function search(term) {
Expand Down
19 changes: 19 additions & 0 deletions notes.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Lesson 2 — commit message comparison

## My quick version (what I'd dash off)
fix search

## Claude's version (the actual commit message)
Fix search to match notes containing the term, not just exact matches

`search` is meant to return every note that *contains* the term, but `matches`
in lib/store.js compared with `===`, so "milk" only matched a note whose text
was exactly "milk" — missing "buy milk" and "milk the almonds". Switched the
predicate to `String.includes`, which is what the two failing tests expect.
All three tests pass.

## Comparison
The quick version ("fix search") says nothing about what was wrong or why the
change is correct. The fuller message explains the actual bug (exact-equality
vs. substring), names the function, and ties the fix to the tests — so a future
reader understands the *why*, not just that something changed.