Skip to content

Conversation

@vtushar06
Copy link
Contributor

@vtushar06 vtushar06 commented Nov 5, 2025

Summary

Refactor Content Library (CatalogList) tests from Vue Test Utils to Vue Testing Library, following VTL best practices of testing user-observable behavior instead of implementation details.

Changes:

  • Converted from mount() + internal state testing to render() + screen + userEvent
  • Created isolated test setup with proper store/router mocks
  • Focused tests on major workflows: initial load, search/filtering, selection mode, downloads

Test coverage:

  • converted 17 tests (some testing internal state/methods) to 15 tests (all testing user-visible behavior)
  • All critical workflows covered: catalog load, search, channel selection, downloads, offline/loading states

Verification:

Ran npm test -- catalogList.spec.js
It passed all 15 tests

References

Closes: #5527

Reviewer guidance

Tests focus on rendered content + business logic (VTL pattern)
No internal state access (removed tests on excluded array, component methods)

@vtushar06 vtushar06 marked this pull request as ready for review November 5, 2025 10:28
@MisRob
Copy link
Member

MisRob commented Nov 7, 2025

Thank you @vtushar06, within next two weeks, we will assign a reviewer.

@vtushar06
Copy link
Contributor Author

Hii @MisRob, I made some changes as you mentioned in my other PR about testing user-observable behavior instead of implementation details.
Please let me know If any more changes are required.

@marcellamaki marcellamaki self-assigned this Nov 18, 2025
@vtushar06
Copy link
Contributor Author

@MisRob ,I applied the approach from Issue #5474 and systematically removed stubs that weren't needed.
The remaining 4 stubs are minimal and necessary:

  • ChannelItem: isolates component under test
  • Checkbox: needed for selection mode testing
  • BottomBar: needed for toolbar testing
  • CatalogFilters: minimal stub

Tests now focus on user-visible behavior, Now PR is ready for review.

@vtushar06 vtushar06 requested a review from MisRob November 20, 2025 04:08
vtushar06 added a commit to vtushar06/studio that referenced this pull request Nov 20, 2025
…n from unstable

The contributor's StudioChip implementation is identical to ours.
We'll use their version from unstable and focus on test refactoring
following Issue learningequality#5536 patterns (data-present vs data-absent scenarios).

Following maintainer guidance from PR learningequality#5540 review.
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.

[Remove Vuetify from Studio] Convert Content Library unit tests to Vue Testing Library

3 participants