Skip to content

Unit testing#2

Open
DenHelloWorld wants to merge 13 commits into
class-componentsfrom
unit-testing
Open

Unit testing#2
DenHelloWorld wants to merge 13 commits into
class-componentsfrom
unit-testing

Conversation

@DenHelloWorld
Copy link
Copy Markdown
Owner

@DenHelloWorld DenHelloWorld commented May 8, 2026

Pull Request: Unit Testing

1. Task URL

React: Unit Testing

2. Screenshot

image

3. Deployment

N/A

4. Done 11.05.2026 / Deadline 12.05.2026

5. Score: 100 / 100

Self-Check:

Feature 1: Test Coverage (+14 points)

  • Statement coverage is 100% (min 80% required).
  • Branch, function, and line coverage are 100% (min 50% required).

Feature 2: No Functional Changes (+14 points)

  • All components remain Class Components.
  • Logic of the components was not modified.

Feature 3: Behavior-Focused Testing (+14 points)

  • Tests focus on user-visible behavior (rendering, clicking, typing) using React Testing Library.
  • No internal implementation details (state, private methods) are tested.

Feature 4: API Mocking (+14 points)

  • All external API calls are mocked using MSW (Mock Service Worker).
  • No real network requests are made during testing.

Feature 5: Error Handling (+14 points)

  • API error scenarios (500 status) are covered by tests.
  • Error Boundary is tested to ensure it catches errors and displays fallback UI.

Feature 6: User Interactions (+14 points)

  • Clicks, input changes, and form interactions are fully covered.
  • Edge cases like empty inputs or whitespace are handled.

Feature 7: LocalStorage Functionality Testing (+16 points)

  • Tests verify reading the search term from localStorage on mount.
  • Tests verify writing the trimmed search term to localStorage after search.

@DenHelloWorld DenHelloWorld self-assigned this May 8, 2026
@DenHelloWorld DenHelloWorld force-pushed the unit-testing branch 2 times, most recently from 33f5fd8 to 9066390 Compare May 8, 2026 15:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant