only expose createDatabase + additional typing

This commit is contained in:
Andrew Thauer
2020-08-14 06:30:05 -04:00
parent 815983ae84
commit 4285289b5a
3 changed files with 20 additions and 6 deletions
@@ -18,7 +18,21 @@ import { mergeDatabaseConfig } from './config';
describe('config', () => {
describe(mergeDatabaseConfig, () => {
it('does not modify the config', () => {
it('does not require overrides', () => {
expect(
mergeDatabaseConfig({
client: 'pg',
connection: '',
useNullAsDefault: true,
}),
).toEqual({
client: 'pg',
connection: '',
useNullAsDefault: true,
});
});
it('accepts an empty object', () => {
expect(
mergeDatabaseConfig(
{
@@ -71,7 +85,7 @@ describe('config', () => {
});
});
it('merges string config objects', () => {
it('replaces a string connection', () => {
expect(
mergeDatabaseConfig(
{
@@ -28,7 +28,10 @@ type DatabaseClient = 'pg' | 'sqlite3' | string;
* @param config The database config
* @param overrides Additional options to merge with the config
*/
export function createDatabase(config: ConfigReader, overrides?: knex.Config) {
export function createDatabase(
config: ConfigReader,
overrides?: Partial<knex.Config>,
) {
const client: DatabaseClient = config.getString('client');
if (client === 'pg') {
@@ -14,7 +14,4 @@
* limitations under the License.
*/
export * from './config';
export * from './connection';
export * from './postgres';
export * from './sqlite3';