@neoma/managed-database
Version:
A managed database fixture for Jest testing (unit, integration etc)
18 lines (17 loc) • 622 B
TypeScript
import { DataSource } from "typeorm";
/**
* Create a new datasource for testing that uses an in-memory SQLite database.
*
* @returns An initialized datasource.
*/
export declare const datasource: () => Promise<DataSource>;
/**
* Convenience function to get the Datasource instance for testing.
*
* Note: The datasource instance's lifecycle is managed by beforeEach and
* afterEach hooks that are automatically added to Jest when this module is
* imported.
*
* @returns A ephemeral DataSource instance for any tests that require a database.
*/
export declare const managedDatasourceInstance: () => DataSource;