Commit 42f26579 authored by Illya Klymov's avatar Illya Klymov

Merge branch 'nfriend-fix-string-array-prop-conversion' into 'master'

Make `convertObjectProps` correctly handle string arrays

See merge request gitlab-org/gitlab!33437
parents 2b63190d b51d1483
......@@ -724,6 +724,8 @@ export const convertObjectProps = (conversionFunction, obj = {}, options = {}) =
} else {
acc[conversionFunction(prop)] = convertObjectProps(conversionFunction, val, options);
}
} else if (isObjParameterArray) {
acc[prop] = val;
} else {
acc[conversionFunction(prop)] = val;
}
......
......@@ -589,6 +589,7 @@ describe('common_utils', () => {
id: 1,
group_name: 'GitLab.org',
absolute_web_url: 'https://gitlab.com/gitlab-org/',
milestones: ['12.3', '12.4'],
},
objNested: {
project_name: 'GitLab CE',
......@@ -599,6 +600,7 @@ describe('common_utils', () => {
frontend_framework: 'Vue',
database: 'PostgreSQL',
},
milestones: ['12.3', '12.4'],
},
},
convertObjectPropsToCamelCase: {
......@@ -606,6 +608,7 @@ describe('common_utils', () => {
id: 1,
group_name: 'GitLab.org',
absolute_web_url: 'https://gitlab.com/gitlab-org/',
milestones: ['12.3', '12.4'],
},
objNested: {
project_name: 'GitLab CE',
......@@ -616,6 +619,7 @@ describe('common_utils', () => {
frontend_framework: 'Vue',
database: 'PostgreSQL',
},
milestones: ['12.3', '12.4'],
},
},
convertObjectPropsToSnakeCase: {
......@@ -623,6 +627,7 @@ describe('common_utils', () => {
id: 1,
groupName: 'GitLab.org',
absoluteWebUrl: 'https://gitlab.com/gitlab-org/',
milestones: ['12.3', '12.4'],
},
objNested: {
projectName: 'GitLab CE',
......@@ -633,6 +638,7 @@ describe('common_utils', () => {
frontendFramework: 'Vue',
database: 'PostgreSQL',
},
milestones: ['12.3', '12.4'],
},
},
};
......@@ -669,16 +675,19 @@ describe('common_utils', () => {
id_converted: 1,
group_name_converted: 'GitLab.org',
absolute_web_url_converted: 'https://gitlab.com/gitlab-org/',
milestones_converted: ['12.3', '12.4'],
},
convertObjectPropsToCamelCase: {
id: 1,
groupName: 'GitLab.org',
absoluteWebUrl: 'https://gitlab.com/gitlab-org/',
milestones: ['12.3', '12.4'],
},
convertObjectPropsToSnakeCase: {
id: 1,
group_name: 'GitLab.org',
absolute_web_url: 'https://gitlab.com/gitlab-org/',
milestones: ['12.3', '12.4'],
},
};
......@@ -696,6 +705,7 @@ describe('common_utils', () => {
frontend_framework: 'Vue',
database: 'PostgreSQL',
},
milestones_converted: ['12.3', '12.4'],
},
convertObjectPropsToCamelCase: {
projectName: 'GitLab CE',
......@@ -706,6 +716,7 @@ describe('common_utils', () => {
frontend_framework: 'Vue',
database: 'PostgreSQL',
},
milestones: ['12.3', '12.4'],
},
convertObjectPropsToSnakeCase: {
project_name: 'GitLab CE',
......@@ -716,6 +727,7 @@ describe('common_utils', () => {
frontendFramework: 'Vue',
database: 'PostgreSQL',
},
milestones: ['12.3', '12.4'],
},
};
......@@ -734,6 +746,7 @@ describe('common_utils', () => {
frontend_framework_converted: 'Vue',
database_converted: 'PostgreSQL',
},
milestones_converted: ['12.3', '12.4'],
},
convertObjectPropsToCamelCase: {
projectName: 'GitLab CE',
......@@ -744,6 +757,7 @@ describe('common_utils', () => {
frontendFramework: 'Vue',
database: 'PostgreSQL',
},
milestones: ['12.3', '12.4'],
},
convertObjectPropsToSnakeCase: {
project_name: 'GitLab CE',
......@@ -754,6 +768,7 @@ describe('common_utils', () => {
frontend_framework: 'Vue',
database: 'PostgreSQL',
},
milestones: ['12.3', '12.4'],
},
};
......@@ -783,6 +798,7 @@ describe('common_utils', () => {
frontend_framework: 'Vue',
database: 'PostgreSQL',
},
milestones_converted: ['12.3', '12.4'],
},
convertObjectPropsToCamelCase: {
projectName: 'GitLab CE',
......@@ -792,6 +808,7 @@ describe('common_utils', () => {
frontend_framework: 'Vue',
database: 'PostgreSQL',
},
milestones: ['12.3', '12.4'],
},
convertObjectPropsToSnakeCase: {
project_name: 'GitLab CE',
......@@ -801,6 +818,7 @@ describe('common_utils', () => {
frontendFramework: 'Vue',
database: 'PostgreSQL',
},
milestones: ['12.3', '12.4'],
},
};
......@@ -826,6 +844,7 @@ describe('common_utils', () => {
backend_converted: 'Ruby',
frontend_framework_converted: 'Vue',
},
milestones_converted: ['12.3', '12.4'],
},
convertObjectPropsToCamelCase: {
projectName: 'GitLab CE',
......@@ -834,6 +853,7 @@ describe('common_utils', () => {
backend: 'Ruby',
frontendFramework: 'Vue',
},
milestones: ['12.3', '12.4'],
},
convertObjectPropsToSnakeCase: {
project_name: 'GitLab CE',
......@@ -842,6 +862,7 @@ describe('common_utils', () => {
backend: 'Ruby',
frontend_framework: 'Vue',
},
milestones: ['12.3', '12.4'],
},
};
......@@ -872,6 +893,7 @@ describe('common_utils', () => {
frontend_framework: 'Vue',
database: 'PostgreSQL',
},
milestones_converted: ['12.3', '12.4'],
},
convertObjectPropsToCamelCase: {
projectName: 'GitLab CE',
......@@ -882,6 +904,7 @@ describe('common_utils', () => {
frontend_framework: 'Vue',
database: 'PostgreSQL',
},
milestones: ['12.3', '12.4'],
},
convertObjectPropsToSnakeCase: {
project_name: 'GitLab CE',
......@@ -892,6 +915,7 @@ describe('common_utils', () => {
frontendFramework: 'Vue',
database: 'PostgreSQL',
},
milestones: ['12.3', '12.4'],
},
};
......@@ -919,6 +943,7 @@ describe('common_utils', () => {
frontend_framework: 'Vue',
database_converted: 'PostgreSQL',
},
milestones_converted: ['12.3', '12.4'],
},
convertObjectPropsToCamelCase: {
projectName: 'GitLab CE',
......@@ -929,6 +954,7 @@ describe('common_utils', () => {
frontend_framework: 'Vue',
database: 'PostgreSQL',
},
milestones: ['12.3', '12.4'],
},
convertObjectPropsToSnakeCase: {
project_name: 'GitLab CE',
......@@ -939,6 +965,7 @@ describe('common_utils', () => {
frontendFramework: 'Vue',
database: 'PostgreSQL',
},
milestones: ['12.3', '12.4'],
},
};
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment