add some tests for normalizeQueryConfig

This commit is contained in:
Stephen Sugden 2012-12-10 23:23:06 -08:00 committed by bmc
parent 5a91dd0c35
commit 5d25bcdcf0

View File

@ -163,3 +163,23 @@ test('types are exported', function() {
var pg = require(__dirname + '/../../lib/index');
assert.ok(pg.types);
});
test('normalizing query configs', function() {
var config
var callback = function () {}
config = utils.normalizeQueryConfig({text: 'TEXT'})
assert.same(config, {text: 'TEXT'})
config = utils.normalizeQueryConfig({text: 'TEXT'}, [10])
assert.deepEqual(config, {text: 'TEXT', values: [10]})
config = utils.normalizeQueryConfig({text: 'TEXT', values: [10]})
assert.deepEqual(config, {text: 'TEXT', values: [10]})
config = utils.normalizeQueryConfig('TEXT', [10], callback)
assert.deepEqual(config, {text: 'TEXT', values: [10], callback: callback})
config = utils.normalizeQueryConfig({text: 'TEXT', values: [10]}, callback)
assert.deepEqual(config, {text: 'TEXT', values: [10], callback: callback})
})