From fa16966f9141e9d8cd14ebf8c7d63cdd722e652d Mon Sep 17 00:00:00 2001 From: Michael Nahkies Date: Wed, 27 Jan 2016 18:06:22 +1300 Subject: [PATCH] add failing test that shows the issue --- test/unit/utils-tests.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/test/unit/utils-tests.js b/test/unit/utils-tests.js index 116dfdd1..b0e3e91f 100644 --- a/test/unit/utils-tests.js +++ b/test/unit/utils-tests.js @@ -171,3 +171,14 @@ test('prepareValue: objects with circular toPostgres rejected', function() { } throw new Error("Expected prepareValue to throw exception"); }); + +test('prepareValue: can safely be used to map an array of values including those with toPostgres functions', function() { + var customType = { + toPostgres: function() { + return "zomgcustom!"; + } + }; + var values = [1, "test", customType] + var out = values.map(utils.prepareValue) + assert.deepEqual(out, [1, "test", "zomgcustom!"]) +})