Skip to content

Add test infrastructure and extract reusable utilities#132

Open
jakebromberg wants to merge 1 commit intomainfrom
feature/test-infrastructure
Open

Add test infrastructure and extract reusable utilities#132
jakebromberg wants to merge 1 commit intomainfrom
feature/test-infrastructure

Conversation

@jakebromberg
Copy link
Member

@jakebromberg jakebromberg commented Jan 31, 2026

Summary

Test utilities:

  • Add shared test helpers (createTestLifecycle, createMockFetch, withEnvVars)
  • Add test data factories for Instagram posts and blog edges

New tests (40 tests):

  • organizingArchive: groupEventsByWeek, generateStructuredData
  • timeUtils: calculateTime formatting
  • breadcrumbUtils: toTitleCase, slugToTitle, generateBreadcrumbs

Improved existing tests (7 tests):

  • posthog: loaded callback behavior in dev/prod modes
  • stream-tracking: edge cases for duration, errors, page events

Extracted utilities:

  • lib/timeUtils.js: calculateTime from AudioPlayerMP3
  • lib/breadcrumbUtils.js: shared breadcrumb logic from Blog/ArchiveBreadcrumbs

Test plan

  • All tests pass
  • Coverage report verified

Test utilities:
- Add shared test helpers (createTestLifecycle, createMockFetch, withEnvVars)
- Add test data factories for Instagram posts and blog edges

New tests (78 tests):
- instagramFilter: extractInstagramPostId, getSuppressedInstagramIds, filterInstagramPosts
- organizingArchive: groupEventsByWeek, generateStructuredData
- instagram: formatInstagramPost, fetchInstagramPosts, getInstagramFeed
- timeUtils: calculateTime formatting
- breadcrumbUtils: toTitleCase, slugToTitle, generateBreadcrumbs

Improved existing tests (7 tests):
- posthog: loaded callback behavior in dev/prod modes
- stream-tracking: edge cases for duration, errors, page events

Extracted utilities:
- lib/timeUtils.js: calculateTime from AudioPlayerMP3
- lib/breadcrumbUtils.js: shared breadcrumb logic from Blog/ArchiveBreadcrumbs

Coverage: 97.7% statements, 93.93% branches, 100% functions
@jakebromberg jakebromberg force-pushed the feature/test-infrastructure branch from 05c226e to 686a1c1 Compare January 31, 2026 04:12
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