Skip to content

Commit

Permalink
fix namespace picker so that it always expands into an object when co…
Browse files Browse the repository at this point in the history
…nstructing a tree
  • Loading branch information
meirish committed Aug 19, 2019
1 parent 6f9fe64 commit b54c6a1
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
2 changes: 1 addition & 1 deletion ui/app/lib/path-to-tree.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export default function(paths) {
return deepmerge.all(
tree.map(p => {
p = p.replace(/\.+/g, DOT_REPLACEMENT);
return unflatten({ [p]: null }, { delimiter: '/' });
return unflatten({ [p]: null }, { delimiter: '/', object: true });
})
);
}
18 changes: 18 additions & 0 deletions ui/tests/unit/lib/path-to-tree-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,24 @@ module('Unit | Lib | path to tree', function() {
},
},
],
[
'leaves with nested number and shared prefix',
['ns1', 'ns1a', 'ns1a/99999/five9s', 'ns1a/999/ns3', 'ns1a/9999/ns3'],
{
ns1: null,
ns1a: {
999: {
ns3: null,
},
9999: {
ns3: null,
},
99999: {
five9s: null,
},
},
},
],
];

tests.forEach(function([name, input, expected]) {
Expand Down

0 comments on commit b54c6a1

Please sign in to comment.