Skip to content

Commit

Permalink
Merge branch 'master' of github.com:gajus/slonik
Browse files Browse the repository at this point in the history
  • Loading branch information
gajus committed May 16, 2019
2 parents 9198eb6 + b2f2416 commit b180ebb
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/factories/createClientConfiguration.js
Expand Up @@ -2,11 +2,13 @@

import type {
ClientConfigurationType,
ClientUserConfigurationType
ClientUserConfigurationType,
TypeParserType
} from '../types';
import createTypeParserPreset from './createTypeParserPreset';

export default (clientUserConfiguration?: ClientUserConfigurationType): ClientConfigurationType => {
const typeParsers: $ReadOnlyArray<TypeParserType> = [];
const configuration = {
captureStackTrace: true,
connectionTimeout: 5000,
Expand All @@ -18,12 +20,12 @@ export default (clientUserConfiguration?: ClientUserConfigurationType): ClientCo
maximumPoolSize: 10,
minimumPoolSize: 0,

// $FlowFixMe
typeParsers: [],
typeParsers,
...clientUserConfiguration
};

if (!configuration.typeParsers || !configuration.typeParsers.length) {
if (!configuration.typeParsers || configuration.typeParsers === typeParsers) {
// $FlowFixMe
configuration.typeParsers = createTypeParserPreset();
}

Expand Down
12 changes: 12 additions & 0 deletions test/slonik/factories/createClientConfiguration.js
Expand Up @@ -61,3 +61,15 @@ test('overrides provided properties', (t) => {
}
);
});

test('disables default type parsers', (t) => {
t.deepEqual(
createClientConfiguration({
typeParsers: []
}),
{
...defaultConfiguration,
typeParsers: []
}
);
});

0 comments on commit b180ebb

Please sign in to comment.