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 = {}) = ...@@ -724,6 +724,8 @@ export const convertObjectProps = (conversionFunction, obj = {}, options = {}) =
} else { } else {
acc[conversionFunction(prop)] = convertObjectProps(conversionFunction, val, options); acc[conversionFunction(prop)] = convertObjectProps(conversionFunction, val, options);
} }
} else if (isObjParameterArray) {
acc[prop] = val;
} else { } else {
acc[conversionFunction(prop)] = val; acc[conversionFunction(prop)] = val;
} }
......
...@@ -589,6 +589,7 @@ describe('common_utils', () => { ...@@ -589,6 +589,7 @@ describe('common_utils', () => {
id: 1, id: 1,
group_name: 'GitLab.org', group_name: 'GitLab.org',
absolute_web_url: 'https://gitlab.com/gitlab-org/', absolute_web_url: 'https://gitlab.com/gitlab-org/',
milestones: ['12.3', '12.4'],
}, },
objNested: { objNested: {
project_name: 'GitLab CE', project_name: 'GitLab CE',
...@@ -599,6 +600,7 @@ describe('common_utils', () => { ...@@ -599,6 +600,7 @@ describe('common_utils', () => {
frontend_framework: 'Vue', frontend_framework: 'Vue',
database: 'PostgreSQL', database: 'PostgreSQL',
}, },
milestones: ['12.3', '12.4'],
}, },
}, },
convertObjectPropsToCamelCase: { convertObjectPropsToCamelCase: {
...@@ -606,6 +608,7 @@ describe('common_utils', () => { ...@@ -606,6 +608,7 @@ describe('common_utils', () => {
id: 1, id: 1,
group_name: 'GitLab.org', group_name: 'GitLab.org',
absolute_web_url: 'https://gitlab.com/gitlab-org/', absolute_web_url: 'https://gitlab.com/gitlab-org/',
milestones: ['12.3', '12.4'],
}, },
objNested: { objNested: {
project_name: 'GitLab CE', project_name: 'GitLab CE',
...@@ -616,6 +619,7 @@ describe('common_utils', () => { ...@@ -616,6 +619,7 @@ describe('common_utils', () => {
frontend_framework: 'Vue', frontend_framework: 'Vue',
database: 'PostgreSQL', database: 'PostgreSQL',
}, },
milestones: ['12.3', '12.4'],
}, },
}, },
convertObjectPropsToSnakeCase: { convertObjectPropsToSnakeCase: {
...@@ -623,6 +627,7 @@ describe('common_utils', () => { ...@@ -623,6 +627,7 @@ describe('common_utils', () => {
id: 1, id: 1,
groupName: 'GitLab.org', groupName: 'GitLab.org',
absoluteWebUrl: 'https://gitlab.com/gitlab-org/', absoluteWebUrl: 'https://gitlab.com/gitlab-org/',
milestones: ['12.3', '12.4'],
}, },
objNested: { objNested: {
projectName: 'GitLab CE', projectName: 'GitLab CE',
...@@ -633,6 +638,7 @@ describe('common_utils', () => { ...@@ -633,6 +638,7 @@ describe('common_utils', () => {
frontendFramework: 'Vue', frontendFramework: 'Vue',
database: 'PostgreSQL', database: 'PostgreSQL',
}, },
milestones: ['12.3', '12.4'],
}, },
}, },
}; };
...@@ -669,16 +675,19 @@ describe('common_utils', () => { ...@@ -669,16 +675,19 @@ describe('common_utils', () => {
id_converted: 1, id_converted: 1,
group_name_converted: 'GitLab.org', group_name_converted: 'GitLab.org',
absolute_web_url_converted: 'https://gitlab.com/gitlab-org/', absolute_web_url_converted: 'https://gitlab.com/gitlab-org/',
milestones_converted: ['12.3', '12.4'],
}, },
convertObjectPropsToCamelCase: { convertObjectPropsToCamelCase: {
id: 1, id: 1,
groupName: 'GitLab.org', groupName: 'GitLab.org',
absoluteWebUrl: 'https://gitlab.com/gitlab-org/', absoluteWebUrl: 'https://gitlab.com/gitlab-org/',
milestones: ['12.3', '12.4'],
}, },
convertObjectPropsToSnakeCase: { convertObjectPropsToSnakeCase: {
id: 1, id: 1,
group_name: 'GitLab.org', group_name: 'GitLab.org',
absolute_web_url: 'https://gitlab.com/gitlab-org/', absolute_web_url: 'https://gitlab.com/gitlab-org/',
milestones: ['12.3', '12.4'],
}, },
}; };
...@@ -696,6 +705,7 @@ describe('common_utils', () => { ...@@ -696,6 +705,7 @@ describe('common_utils', () => {
frontend_framework: 'Vue', frontend_framework: 'Vue',
database: 'PostgreSQL', database: 'PostgreSQL',
}, },
milestones_converted: ['12.3', '12.4'],
}, },
convertObjectPropsToCamelCase: { convertObjectPropsToCamelCase: {
projectName: 'GitLab CE', projectName: 'GitLab CE',
...@@ -706,6 +716,7 @@ describe('common_utils', () => { ...@@ -706,6 +716,7 @@ describe('common_utils', () => {
frontend_framework: 'Vue', frontend_framework: 'Vue',
database: 'PostgreSQL', database: 'PostgreSQL',
}, },
milestones: ['12.3', '12.4'],
}, },
convertObjectPropsToSnakeCase: { convertObjectPropsToSnakeCase: {
project_name: 'GitLab CE', project_name: 'GitLab CE',
...@@ -716,6 +727,7 @@ describe('common_utils', () => { ...@@ -716,6 +727,7 @@ describe('common_utils', () => {
frontendFramework: 'Vue', frontendFramework: 'Vue',
database: 'PostgreSQL', database: 'PostgreSQL',
}, },
milestones: ['12.3', '12.4'],
}, },
}; };
...@@ -734,6 +746,7 @@ describe('common_utils', () => { ...@@ -734,6 +746,7 @@ describe('common_utils', () => {
frontend_framework_converted: 'Vue', frontend_framework_converted: 'Vue',
database_converted: 'PostgreSQL', database_converted: 'PostgreSQL',
}, },
milestones_converted: ['12.3', '12.4'],
}, },
convertObjectPropsToCamelCase: { convertObjectPropsToCamelCase: {
projectName: 'GitLab CE', projectName: 'GitLab CE',
...@@ -744,6 +757,7 @@ describe('common_utils', () => { ...@@ -744,6 +757,7 @@ describe('common_utils', () => {
frontendFramework: 'Vue', frontendFramework: 'Vue',
database: 'PostgreSQL', database: 'PostgreSQL',
}, },
milestones: ['12.3', '12.4'],
}, },
convertObjectPropsToSnakeCase: { convertObjectPropsToSnakeCase: {
project_name: 'GitLab CE', project_name: 'GitLab CE',
...@@ -754,6 +768,7 @@ describe('common_utils', () => { ...@@ -754,6 +768,7 @@ describe('common_utils', () => {
frontend_framework: 'Vue', frontend_framework: 'Vue',
database: 'PostgreSQL', database: 'PostgreSQL',
}, },
milestones: ['12.3', '12.4'],
}, },
}; };
...@@ -783,6 +798,7 @@ describe('common_utils', () => { ...@@ -783,6 +798,7 @@ describe('common_utils', () => {
frontend_framework: 'Vue', frontend_framework: 'Vue',
database: 'PostgreSQL', database: 'PostgreSQL',
}, },
milestones_converted: ['12.3', '12.4'],
}, },
convertObjectPropsToCamelCase: { convertObjectPropsToCamelCase: {
projectName: 'GitLab CE', projectName: 'GitLab CE',
...@@ -792,6 +808,7 @@ describe('common_utils', () => { ...@@ -792,6 +808,7 @@ describe('common_utils', () => {
frontend_framework: 'Vue', frontend_framework: 'Vue',
database: 'PostgreSQL', database: 'PostgreSQL',
}, },
milestones: ['12.3', '12.4'],
}, },
convertObjectPropsToSnakeCase: { convertObjectPropsToSnakeCase: {
project_name: 'GitLab CE', project_name: 'GitLab CE',
...@@ -801,6 +818,7 @@ describe('common_utils', () => { ...@@ -801,6 +818,7 @@ describe('common_utils', () => {
frontendFramework: 'Vue', frontendFramework: 'Vue',
database: 'PostgreSQL', database: 'PostgreSQL',
}, },
milestones: ['12.3', '12.4'],
}, },
}; };
...@@ -826,6 +844,7 @@ describe('common_utils', () => { ...@@ -826,6 +844,7 @@ describe('common_utils', () => {
backend_converted: 'Ruby', backend_converted: 'Ruby',
frontend_framework_converted: 'Vue', frontend_framework_converted: 'Vue',
}, },
milestones_converted: ['12.3', '12.4'],
}, },
convertObjectPropsToCamelCase: { convertObjectPropsToCamelCase: {
projectName: 'GitLab CE', projectName: 'GitLab CE',
...@@ -834,6 +853,7 @@ describe('common_utils', () => { ...@@ -834,6 +853,7 @@ describe('common_utils', () => {
backend: 'Ruby', backend: 'Ruby',
frontendFramework: 'Vue', frontendFramework: 'Vue',
}, },
milestones: ['12.3', '12.4'],
}, },
convertObjectPropsToSnakeCase: { convertObjectPropsToSnakeCase: {
project_name: 'GitLab CE', project_name: 'GitLab CE',
...@@ -842,6 +862,7 @@ describe('common_utils', () => { ...@@ -842,6 +862,7 @@ describe('common_utils', () => {
backend: 'Ruby', backend: 'Ruby',
frontend_framework: 'Vue', frontend_framework: 'Vue',
}, },
milestones: ['12.3', '12.4'],
}, },
}; };
...@@ -872,6 +893,7 @@ describe('common_utils', () => { ...@@ -872,6 +893,7 @@ describe('common_utils', () => {
frontend_framework: 'Vue', frontend_framework: 'Vue',
database: 'PostgreSQL', database: 'PostgreSQL',
}, },
milestones_converted: ['12.3', '12.4'],
}, },
convertObjectPropsToCamelCase: { convertObjectPropsToCamelCase: {
projectName: 'GitLab CE', projectName: 'GitLab CE',
...@@ -882,6 +904,7 @@ describe('common_utils', () => { ...@@ -882,6 +904,7 @@ describe('common_utils', () => {
frontend_framework: 'Vue', frontend_framework: 'Vue',
database: 'PostgreSQL', database: 'PostgreSQL',
}, },
milestones: ['12.3', '12.4'],
}, },
convertObjectPropsToSnakeCase: { convertObjectPropsToSnakeCase: {
project_name: 'GitLab CE', project_name: 'GitLab CE',
...@@ -892,6 +915,7 @@ describe('common_utils', () => { ...@@ -892,6 +915,7 @@ describe('common_utils', () => {
frontendFramework: 'Vue', frontendFramework: 'Vue',
database: 'PostgreSQL', database: 'PostgreSQL',
}, },
milestones: ['12.3', '12.4'],
}, },
}; };
...@@ -919,6 +943,7 @@ describe('common_utils', () => { ...@@ -919,6 +943,7 @@ describe('common_utils', () => {
frontend_framework: 'Vue', frontend_framework: 'Vue',
database_converted: 'PostgreSQL', database_converted: 'PostgreSQL',
}, },
milestones_converted: ['12.3', '12.4'],
}, },
convertObjectPropsToCamelCase: { convertObjectPropsToCamelCase: {
projectName: 'GitLab CE', projectName: 'GitLab CE',
...@@ -929,6 +954,7 @@ describe('common_utils', () => { ...@@ -929,6 +954,7 @@ describe('common_utils', () => {
frontend_framework: 'Vue', frontend_framework: 'Vue',
database: 'PostgreSQL', database: 'PostgreSQL',
}, },
milestones: ['12.3', '12.4'],
}, },
convertObjectPropsToSnakeCase: { convertObjectPropsToSnakeCase: {
project_name: 'GitLab CE', project_name: 'GitLab CE',
...@@ -939,6 +965,7 @@ describe('common_utils', () => { ...@@ -939,6 +965,7 @@ describe('common_utils', () => {
frontendFramework: 'Vue', frontendFramework: 'Vue',
database: 'PostgreSQL', 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