From d7a23d09aa79ab7c46c77adca14e9d7f282f7944 Mon Sep 17 00:00:00 2001 From: Dan VerWeire Date: Wed, 1 Jan 2020 12:32:41 -0500 Subject: [PATCH] test: add failing test for #74 --- test/test.js | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/test/test.js b/test/test.js index 86039c4..38d22f9 100644 --- a/test/test.js +++ b/test/test.js @@ -2637,3 +2637,22 @@ test("issue #71: mapping array should not fail when not defined", t => { t.deepEqual(result, expect); t.end(); }); + +test("issue #74: mapping empty array should result in empty array", t => { + const src = {nbMember : 5, activityList: []}; + + const map = { + 'nbMember': 'maxPlayerCount' + , 'activityList[].id': 'activityList[].id' + }; + + const expect = { + activityList: [] + , maxPlayerCount: 5 + } + + const result = om(src, map); + + t.deepEqual(result, expect); + t.end(); +}); \ No newline at end of file