Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

add some tests for normalizeQueryConfig

  • Loading branch information...
commit 5d25bcdcf0bd4b2cf026bc4d00505be142ae7121 1 parent 5a91dd0
@grncdr grncdr authored committed
Showing with 20 additions and 0 deletions.
  1. +20 −0 test/unit/utils-tests.js
View
20 test/unit/utils-tests.js
@@ -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})
+})
Please sign in to comment.
Something went wrong with that request. Please try again.