From 38ac518095f6ef5d47604bef029d97ed858e7825 Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Sun, 27 Sep 2015 10:03:43 -0700 Subject: [PATCH] Add `_#toString` test for nullish values. --- test/test.js | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/test/test.js b/test/test.js index 13e461a1c..0cc54668c 100644 --- a/test/test.js +++ b/test/test.js @@ -20602,6 +20602,25 @@ skipTest(assert); } }); + + QUnit.test('should treat nullish values as empty strings', function(assert) { + assert.expect(1); + + if (!isNpm) { + var values = [, null, undefined], + expected = _.map(values, _.constant('')); + + var actual = _.map(values, function(value, index) { + var wrapped = index ? _(value) : _(); + return String(wrapped); + }); + + assert.deepEqual(actual, expected); + } + else { + skipTest(assert); + } + }); }()); /*--------------------------------------------------------------------------*/