Repository URL to install this package:
|
Version:
5.0.0-rc.5 ▾
|
import { flatten, unflatten } from './transform';
jest.mock('fs');
describe('Utility functions', () => {
test('flatten/unflatten', () => {
const hierarchical = {
billing: {
components: {
App: {
doodle: 'Doodle',
pricing: 'Pricing',
},
},
},
};
const flat = {
'billing.components.App.doodle': 'Doodle',
'billing.components.App.pricing': 'Pricing',
};
expect(flatten(hierarchical)).toEqual(flat);
expect(unflatten(flatten(hierarchical))).toEqual(hierarchical);
expect(flatten(unflatten(flat))).toEqual(flat);
});
});