Revert changes to common.spec.js

This commit is contained in:
devendra-bruno
2025-05-26 09:47:43 +05:30
parent 3e714ab9f8
commit 0948964677

View File

@@ -24,25 +24,25 @@ describe('utils: flattenDataForDotNotation', () => {
{ name: 'Bob', age: 28 },
],
};
const expectedOutput = {
'users[0].name': 'Alice',
'users[0].age': 25,
'users[1].name': 'Bob',
'users[1].age': 28,
};
expect(flattenDataForDotNotation(input)).toEqual(expectedOutput);
});
test('Flatten an empty object', () => {
const input = {};
const expectedOutput = {};
expect(flattenDataForDotNotation(input)).toEqual(expectedOutput);
});
test('Flatten an object with nested objects', () => {
const input = {
person: {
@@ -53,16 +53,16 @@ describe('utils: flattenDataForDotNotation', () => {
},
},
};
const expectedOutput = {
'person.name': 'Alice',
'person.address.city': 'New York',
'person.address.zipcode': '10001',
};
expect(flattenDataForDotNotation(input)).toEqual(expectedOutput);
});
test('Flatten an object with arrays of objects', () => {
const input = {
teams: [
@@ -70,7 +70,7 @@ describe('utils: flattenDataForDotNotation', () => {
{ name: 'Team B', members: ['Charlie', 'David'] },
],
};
const expectedOutput = {
'teams[0].name': 'Team A',
'teams[0].members[0]': 'Alice',
@@ -79,7 +79,7 @@ describe('utils: flattenDataForDotNotation', () => {
'teams[1].members[0]': 'Charlie',
'teams[1].members[1]': 'David',
};
expect(flattenDataForDotNotation(input)).toEqual(expectedOutput);
});
});