grafana/public/app/core/specs/flatten.test.ts
renovate[bot] d87cd6f26c
Update dependency prettier to v2.5.1 (#43473)
* Update dependency prettier to v2.5.1

* prettier fixes

* chore(toolkit): bump prettier to 2.5.1

* style(eslint): bump grafana config to 2.5.2 in core and toolkit

* style(mssql-datasource): fix no-inferrable-types eslint errors

Co-authored-by: Renovate Bot <bot@renovateapp.com>
Co-authored-by: Ashley Harrison <ashley.harrison@grafana.com>
Co-authored-by: Jack Westbrook <jack.westbrook@gmail.com>
2022-02-02 12:02:32 +00:00

23 lines
606 B
TypeScript

import flatten from 'app/core/utils/flatten';
describe('flatten', () => {
it('should return flatten object', () => {
const flattened = flatten(
{
level1: 'level1-value',
deeper: {
level2: 'level2-value',
deeper: {
level3: 'level3-value',
},
},
},
null as unknown as { delimiter?: any; maxDepth?: any; safe?: any }
);
expect(flattened['level1']).toBe('level1-value');
expect(flattened['deeper.level2']).toBe('level2-value');
expect(flattened['deeper.deeper.level3']).toBe('level3-value');
});
});