From 59f0f4d70ea36dac86bb1c40abaf587eabc541be Mon Sep 17 00:00:00 2001 From: missinglink Date: Mon, 26 Mar 2018 19:57:13 +0200 Subject: [PATCH] add line comment, fix line comment --- helper/fieldValue.js | 2 +- test/unit/helper/fieldValue.js | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/helper/fieldValue.js b/helper/fieldValue.js index 147bf625..6a9c5c10 100644 --- a/helper/fieldValue.js +++ b/helper/fieldValue.js @@ -17,7 +17,7 @@ function getStringValue(property) { return property; } - // array value, take first item in array (at this time only used for admin values) + // array value, take first item in array (at this time only used for admin & name values) if (_.isArray(property)) { return property[0]; } diff --git a/test/unit/helper/fieldValue.js b/test/unit/helper/fieldValue.js index d4784b9f..d3d007fe 100644 --- a/test/unit/helper/fieldValue.js +++ b/test/unit/helper/fieldValue.js @@ -11,6 +11,9 @@ module.exports.tests.getStringValue = function(test) { t.equal(field.getStringValue(['']), '', 'array with empty string'); t.equal(field.getStringValue(-0), '-0', 'number'); t.equal(field.getStringValue(+0), '0', 'number'); + + // note: this behaviour is not desirable, it was inherited during a refactor + // see: https://github.com/pelias/api/pull/1102 t.equal(field.getStringValue({foo: 'bar'}), '[object Object]', '_.toString'); t.end(); });