Skip to content

test: add comprehensive tests for Tumblr readers#17

Merged
gvonness-apolitical merged 1 commit intomainfrom
test/tumblr-readers
Feb 3, 2026
Merged

test: add comprehensive tests for Tumblr readers#17
gvonness-apolitical merged 1 commit intomainfrom
test/tumblr-readers

Conversation

@gvonness-apolitical
Copy link
Copy Markdown
Collaborator

Summary

Adds comprehensive unit tests for TumblrReader and TumblrPlaylistReader, increasing test coverage for the reader implementations.

Tests Added

TumblrReader (21 tests)

  • load() - throws error when called directly
  • loadFromUrl() - initialization, custom proxy, callbacks, error handling
  • Navigation - next(), prev(), goTo() with history tracking
  • getNavigation() - returns navigation object with methods
  • hasNavigation() - correct navigation availability states
  • getCurrentPost(), getBlogName() - post data access
  • setOnPageChange() - callback updates
  • Cache integration - uses cached posts when available
  • destroy() - cleanup resources

TumblrPlaylistReader (21 tests)

  • load() - throws error when called directly
  • loadFromPlaylist() - playlist parsing, URL extraction, ToC generation
  • Navigation - next(), prev(), goTo() with boundary handling
  • getToc(), goToTocItem() - ToC navigation
  • hasNavigation() - correct states at first/middle/last posts
  • prefetchAll() - progress callbacks, prevents duplicate runs
  • clearCache() - cache clearing and ToC updates
  • exportAsEpub() - EPUB generation
  • getDefaultEpubTitle(), getBlogName() - metadata access
  • destroy() - cleanup resources

Impact

  • Test count: 149 → 191 (+42 tests)
  • New test files: 833 lines

Test plan

  • All 191 tests pass
  • Build succeeds

TumblrReader tests (21):
- load() error handling
- loadFromUrl() with options and callbacks
- Navigation (next, prev, goTo)
- History management
- Cache integration
- getNavigation, hasNavigation
- getCurrentPost, getBlogName
- destroy cleanup

TumblrPlaylistReader tests (21):
- load() error handling
- loadFromPlaylist() with URL extraction
- Navigation (next, prev, goTo)
- ToC generation and navigation
- hasNavigation states
- prefetchAll with progress
- clearCache and ToC updates
- exportAsEpub
- destroy cleanup

Increases test count from 149 to 191 (+42 tests)
@gvonness-apolitical gvonness-apolitical merged commit fa41055 into main Feb 3, 2026
3 checks passed
@gvonness-apolitical gvonness-apolitical deleted the test/tumblr-readers branch February 3, 2026 03:29
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