Add comprehensive test suite and improve Expo integration#3
Merged
andyfischer merged 4 commits intomainfrom Apr 6, 2026
Merged
Add comprehensive test suite and improve Expo integration#3andyfischer merged 4 commits intomainfrom
andyfischer merged 4 commits intomainfrom
Conversation
expoLaunch() now accepts pre-created ExpoSqliteDatabase instances so endpoint handlers can close over the same db reference. Updated dependency to ^0.6.0 for /core subpath. Added 22 unit tests and a sample app demonstrating the recommended bootstrap pattern. https://claude.ai/code/session_0181oRm3itxnkB6WVZMjer4U
- Error handling parity: HttpErrors normalized to webFetch format - Auth context: getAuth option on createExpoFetch and expoLaunch - ExpoEventEmitter: in-process SSE equivalent with key-based subscriptions - usePrismApp() React hook for async initialization lifecycle - migrateSchema(): tracks applied statements for safe app updates - shutdown() on ExpoLaunchResult for clean database closing - Dev warning when host option passed to expoFetch - Integration tests with real SQLite via better-sqlite3 - Added Authorization export to prism-framework/core - Sample Expo app with full project structure - 48 tests total (unit, integration, React hook) https://claude.ai/code/session_0181oRm3itxnkB6WVZMjer4U
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds a complete test suite for the
prism-framework-expopackage and improves the Expo integration with better documentation, error handling, and developer experience features.Key Changes
Testing Infrastructure
vitestconfiguration and test suite covering:ExpoSqliteDatabase— database operations (get, list, run, close, schema initialization)ExpoEventEmitter— event subscription/publishing with proper cleanupcreateExpoFetch— endpoint routing, parameter handling, error normalizationexpoLaunch— app initialization, database setup, middleware warnings, job startupusePrismApp— React hook for async initialization with loading/error statesCore Improvements
expoLaunch()now accepts pre-createdExpoSqliteDatabaseinstances, allowing endpoints to close over the same database reference (fixes a critical pattern for mobile apps)HttpErrorexceptions fromcallEndpoint()are now normalized to matchwebFetcherror format ("Fetch error, status: N")createExpoFetch()now wraps calls inwithRequestContext()so endpoints can access auth viagetCurrentRequestContext()getAuthoption to bothexpoLaunch()andcreateExpoFetch()for providing authorization data on each requestmigrateSchema()method toExpoSqliteDatabasefor tracking applied migrations (safer for app updates)New Exports
ExpoEventEmitter— in-process event emitter (mobile equivalent of SSE)usePrismApp— React hook for managing async initialization in Expo layoutsAuthorizationre-exported from core for mobile auth patternsDocumentation & Examples
creating-mobile-apps.mdwith modern patterns (database injection, React hooks, auth)README.mdwith clearer setup examples and API documentation_layout.tsx— demonstratesusePrismApphook integrationprismSetup.ts— app and database initializationnotesService.ts— platform-agnostic service with database accessNotesScreen.tsx— React Native component usingapiFetchImplementation Details
ExpoEventEmitterusesMap<string, Set<callback>>for efficient key-based event routing with automatic cleanupExpoSqliteDatabase.migrateSchema()uses SHA-256 hashing of statements to track migrationscreateExpoSQLiteMock()wrapper around better-sqlite3 to simulate expo-sqlite's synchronous APIvitestwith proper cleanup (temp directories, database connections)Breaking Changes
None — all changes are additive or improve existing behavior.
https://claude.ai/code/session_0181oRm3itxnkB6WVZMjer4U