feat: extend Node mock with connections and statements - #420
Merged
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This branch was successfully deployed
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.
The Node test mock cannot exercise NitroSQLite 10 code that uses independent connections, prepared statements, or callback transactions. This extends
react-native-nitro-sqlite/mockwith those APIs and temporary database files, following Onyx PR #851. Hubert Sosinski authored the original Onyx mock; the existing attribution and MIT notice remain in place.Connections share files by name and location, and read-only opens require an existing database. Prepared statements support repeated execution, fresh bindings, and finalization. The mock reuses the managed connection queue so callback transactions stay exclusive across
await, commit on success, and roll back on error. Explicit commit and rollback also work.Closing a connection now preserves its data for reopening.
delete()removes the database, andresetAllDatabases()closes idle handles and removes every temporary file. The Node testing guide covers these lifecycles and limits, and TypeDoc now generates a separate reference for the mock export.The integration tests cover rollback isolation, queue order, statement lifecycle, and a read-only WAL snapshot while another connection commits a write. SQL still runs on Node's thread, so native scheduling and performance require device tests.