sqliteStateProviderConformanceCases
VariableSignature
const sqliteStateProviderConformanceCases: ConformanceTestCase<SqliteStateProviderConformanceContext>[];sqlite/src/conformance/state-provider-conformance.ts:499
Every 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.
Example
TypeScript
import { after, before, test } from "node:test";
const client = createClient({ url: ":memory:" });
const lock = createAsyncRwLock();
let context: SqliteStateProviderConformanceContext;
before(async () => {
context = await createSqliteStateProviderConformanceContext({
createStateProvider: async () => createLibsqlStateProvider({ client, lock }),
withNonTransactionContext: async (fn) => fn({ client }),
});
});
after(() => client.close());
for (const conformanceCase of [
...sqliteStateProviderConformanceCases,
...asyncSqliteStateProviderConformanceCases,
]) {
void test(conformanceCase.title, async () => {
await conformanceCase.run(context);
});
}