Skip to content

Commit

Permalink
test: add failing test for #71
Browse files Browse the repository at this point in the history
  • Loading branch information
wankdanker committed Dec 27, 2019
1 parent d697d47 commit dbfab93
Showing 1 changed file with 21 additions and 2 deletions.
23 changes: 21 additions & 2 deletions test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2612,9 +2612,28 @@ test("issue #69: should create an array of values", t => {
var map = { identification: 'id'};

var expect = { id: [ 1235, 9876 ] };

var result = om(src, map);

t.deepEqual(result, expect);
t.end();
});
});

test("issue #71: mapping array should not fail when not defined", t => {
const src = {};

const map = {
mySizes: [{
key: 'sizes',
transform: sizes => sizes.map(data => data),
default: () => []
}]
};

const expect = { sizes: [] };

const result = om(src, map);

t.deepEqual(result, expect);
t.end();
});

0 comments on commit dbfab93

Please sign in to comment.