@queuert/sqlite/conformance
Conformance cases for SQLite providers.
$npm install @queuert/sqlite
Functions2
- createSqliteMigratorConformanceContextExperimentalSqliteMigratorConformanceContext
- createSqliteStateProviderConformanceContextPrepares the context the sqliteStateProviderConformanceCases run against: migrates the schema once through a provider from createStateProvider. Each case then builds its own adapter over a new provider from it, with the tables cleared. Call it once the database is ready, such as in beforeAll; the test file owns the database and releases it itself.
Types3
- ConformanceTestCaseOne conformance case, to wrap in a test of any test runner. The test file creates the context before the cases (for example in beforeAll) and releases the resources behind it, such as the database, after them.
- SqliteMigratorConformanceContextExperimentalThe context the sqliteMigratorConformanceCases run against, over a provider of either mode. Get it from createSqliteMigratorConformanceContext and pass it to every case unchanged.
- SqliteStateProviderConformanceContextThe context the sqliteStateProviderConformanceCases run against, over a provider of either mode. Get it from createSqliteStateProviderConformanceContext and pass it to every case unchanged.
Variables3
- asyncSqliteStateProviderConformanceCasesThe state adapter contract cases that hold a transaction open across an await, run through createSqliteStateAdapter over the provider. Only an async provider can pass them; it runs them next to sqliteStateProviderConformanceCases.
- sqliteMigratorConformanceCasesExperimentalCases that check createSqliteMigrator over the provider in its mode: its history, transactional and non-transactional migrations, reverts and, over an asynchronous provider, its lease. The synchronous migrator takes no lease, so the lease cases pass without running over a provider with sync: true. Run them one per test in your own test file against a context from createSqliteMigratorConformanceContext. Works with any test runner.
- sqliteStateProviderConformanceCasesEvery state adapter contract case, run through createSqliteStateAdapter over the provider in its mode, plus checks of the provider's classifyError. Over a provider with sync: true they also check its own contract: results without a promise, commit, rollback, isTransaction, and an autocommit statement that throws inside an open transaction. Run them one per test in your own test file against a context from createSqliteStateProviderConformanceContext; an async provider also runs asyncSqliteStateProviderConformanceCases. Works with any test runner.