Skip to content

Add count command to print how many notes exist - #310

Open
GoVolodya wants to merge 1 commit into
mate-academy:mainfrom
GoVolodya:add-count-command
Open

GoVolodya wants to merge 1 commit into
mate-academy:mainfrom
GoVolodya:add-count-command

Conversation

@GoVolodya

Copy link
Copy Markdown

What

  • New count command: node notes.js count prints You have N notes. (note for exactly one).
  • store.count() in lib/store.js returns the number of stored notes.
  • count added to the help text in notes.js and to the command list in the README.
  • New test: count() equals all().length.

Why

Lets users see how many notes they have without listing them all (Lesson 3 task).

Testing

npm test: 4/4 pass (3 existing + 1 new). node notes.js count prints You have 0 notes. on an empty store.

For reviewers

The new test reads the real notes.json (via store) rather than a fixture, so it only checks that count() and all() agree, not specific numbers.

🤖 Generated with Claude Code

Adds store.count() and a 'count' command in notes.js that prints
"You have N notes." (singular for one note). Lists the command in the
help text and README, and adds a test that count() matches the number
of stored notes. All four tests pass.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
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.

1 participant