Skip to content

Test: regression coverage for the 'N notes loading…' sidebar banner #30

@thetechjon

Description

@thetechjon

Context

When a fresh user clones a vault, note bodies stream in progressively (the sidebar tree shows note titles immediately; bodies arrive in the background). While bodies are still loading, the sidebar shows a subtle "N notes loading…" banner driven by counting notes with contentLoaded === false. This is a feature the maintainer asked to keep visible after it regressed in an earlier refactor.

A regression test would lock it in so the banner cannot silently disappear again.

Where to look

  • src/components/sidebar/FolderTree.tsx lines 102-110 — shellCount calculation; the banner JSX is in the same component, search for loading in the file.
  • src/__tests__/ — existing component tests use @testing-library/react (see e.g. src/__tests__/markdownLivePreview.test.ts or other tests for the pattern).

Acceptance criteria

  • New test file src/__tests__/folderTreeLoadingBanner.test.tsx (or extend an existing FolderTree test).
  • Test 1: render FolderTree with 3 notes, 2 of them contentLoaded: false. Assert the banner is in the DOM and shows the right count.
  • Test 2: render with all notes contentLoaded: true. Assert the banner is NOT in the DOM.
  • Test 3: render with 0 notes. Assert the banner is NOT in the DOM (empty vault case).

Complexity

Tiny. Good first PR if you have never touched React testing before.

For first-time contributors

Read CONTRIBUTING.md. npm install then npm test to confirm the suite passes locally before you start. The existing tests under src/__tests__/ are the best reference for the patterns the codebase uses. PR against dev.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions