@queuert/postgres/conformance
Conformance cases for PostgreSQL providers.
$npm install @queuert/postgres
Functions3
- createPgMigratorConformanceContextExperimentalPgMigratorConformanceContext
- createPgNotifyProviderConformanceContextPrepares the context the pgNotifyProviderConformanceCases run against: each case gets its own notify adapter over a new provider, on channels of its own. The test file still owns the provider's resources and releases them itself.
- createPgStateProviderConformanceContextPrepares the context the pgStateProviderConformanceCases 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.
Types4
- 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.
- NotifyAdapterConformanceContextThe context the notify adapter conformance cases run against, for an adapter of either mode. Create it once, before the cases. Each case creates the adapters it needs from it, and they are closed when the case ends.
- PgMigratorConformanceContextExperimentalThe context the pgMigratorConformanceCases run against. Get it from createPgMigratorConformanceContext and pass it to every case unchanged.
- PgStateProviderConformanceContextThe context the pgStateProviderConformanceCases run against. Get it from createPgStateProviderConformanceContext and pass it to every case unchanged.
Variables3
- pgMigratorConformanceCasesExperimentalCases that check createPgMigrator over a provider: its history, transactional and non-transactional migrations, reverts and lease. Run them one per test in your own test file against a context from createPgMigratorConformanceContext. Works with any test runner.
- pgNotifyProviderConformanceCasesEvery notify adapter contract case, run through createPgNotifyAdapter over a provider. Run them one per test in your own test file against a context from createPgNotifyProviderConformanceContext. Works with any test runner.
- pgStateProviderConformanceCasesEvery state adapter contract case, including those that hold two transactions open at once, run through createPgStateAdapter over a provider, plus checks of the provider's classifyError. Run them one per test in your own test file against a context from createPgStateProviderConformanceContext. Works with any test runner.