Skip to content

refactor: Effect best practices and comprehensive tests - #11

Merged
russwyte merged 1 commit into
mainfrom
refactor/effect-best-practices
Mar 12, 2026
Merged

russwyte merged 1 commit into
mainfrom
refactor/effect-best-practices

Conversation

@russwyte

Copy link
Copy Markdown
Owner

Summary

  • Migrate all error types (ConfigError, InvalidPostIdError, SlabApiError, SlabNetworkError, DeltaConversionError) to Data.TaggedError with single-object constructors
  • Wrap external library calls (quill-delta-to-html, turndown) in Effect.try for proper error boundary handling
  • Make deltaToMarkdown and contentToMarkdown return Effect values, propagating errors through the Effect pipeline
  • Make transformPost effectful, with all callers properly yielding results

Tests

  • 56 total tests (36 new), all passing
  • New test files: test/config.test.ts, test/deltaToMarkdown.test.ts
  • Edge cases: null/empty content, missing data fields, network errors, multiple GraphQL errors, null search nodes, empty delta arrays, string content passthrough

Migrate all error types to Data.TaggedError, wrap external library calls
(quill-delta-to-html, turndown) in Effect.try for proper error handling,
and make deltaToMarkdown/contentToMarkdown return Effect values. Add 36
new tests covering edge cases including null content, empty deltas,
network errors, GraphQL errors, and missing data fields.
@russwyte
russwyte merged commit fe6eac4 into main Mar 12, 2026
1 check passed
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