Skip to content

Commit 69bffe1

Browse files
committed
test: add cases for Lib.expandObjectPaths w/ array containers
1 parent 2ac3dd7 commit 69bffe1

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

test/jasmine/tests/lib_test.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -590,6 +590,20 @@ describe('Test lib.js:', function() {
590590
expect(computed).toLooseDeepEqual(expected);
591591
});
592592

593+
it('does not skip over array container set to null values', function() {
594+
var input = {title: 'clear annotations', annotations: null};
595+
var expected = {title: 'clear annotations', annotations: null};
596+
var computed = Lib.expandObjectPaths(input);
597+
expect(computed).toLooseDeepEqual(expected);
598+
});
599+
600+
it('expands array containers', function() {
601+
var input = {title: 'clear annotation 1', 'annotations[1]': { title: 'new' }};
602+
var expected = {title: 'clear annotation 1', annotations: [null, { title: 'new' }]};
603+
var computed = Lib.expandObjectPaths(input);
604+
expect(computed).toLooseDeepEqual(expected);
605+
});
606+
593607
// TODO: This test is unimplemented since it's a currently-unused corner case.
594608
// Getting the test to pass requires some extension (pun?) to extendDeepNoArrays
595609
// that's intelligent enough to only selectively merge *some* arrays, in particular

0 commit comments

Comments
 (0)