mirror of
https://github.com/hexastack/hexabot
synced 2025-06-26 18:27:28 +00:00
fix: handle unit tests arrays case
This commit is contained in:
parent
b200fbf6da
commit
0b9f6e49e1
@ -76,6 +76,25 @@ describe('flatten', () => {
|
||||
});
|
||||
});
|
||||
|
||||
it('should handle arrays as values without recursing into them', () => {
|
||||
const object = {
|
||||
items: [1, 2, 3],
|
||||
nested: {
|
||||
moreItems: [4, 5, 6],
|
||||
deepNested: {
|
||||
evenMoreItems: [7, 8, 9],
|
||||
},
|
||||
},
|
||||
};
|
||||
const result = flatten(object);
|
||||
|
||||
expect(result).toStrictEqual({
|
||||
items: [1, 2, 3],
|
||||
'nested.moreItems': [4, 5, 6],
|
||||
'nested.deepNested.evenMoreItems': [7, 8, 9],
|
||||
});
|
||||
});
|
||||
|
||||
it('should support an object without nested object', () => {
|
||||
const object = {
|
||||
name: 'name',
|
||||
|
Loading…
Reference in New Issue
Block a user