Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2019-12-12 12:07:48 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2019-12-12 12:07:48 +0300
commitfc53ce8e6ca67bf217470179a1ea6cf139bcffad (patch)
tree3721386728719a7779d1cd627281e9a28cc40c4a /spec/javascripts/lib/utils/common_utils_spec.js
parent8e22ef10e4f9c6d1ef2411aa26ddd0658e2f1461 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/javascripts/lib/utils/common_utils_spec.js')
-rw-r--r--spec/javascripts/lib/utils/common_utils_spec.js22
1 files changed, 22 insertions, 0 deletions
diff --git a/spec/javascripts/lib/utils/common_utils_spec.js b/spec/javascripts/lib/utils/common_utils_spec.js
index 484133c9ac4..e471be608c8 100644
--- a/spec/javascripts/lib/utils/common_utils_spec.js
+++ b/spec/javascripts/lib/utils/common_utils_spec.js
@@ -721,6 +721,28 @@ describe('common_utils', () => {
});
});
+ describe('convertObjectPropsToSnakeCase', () => {
+ it('converts each object key to snake case', () => {
+ const obj = {
+ some: 'some',
+ 'cool object': 'cool object',
+ likeThisLongOne: 'likeThisLongOne',
+ };
+
+ expect(commonUtils.convertObjectPropsToSnakeCase(obj)).toEqual({
+ some: 'some',
+ cool_object: 'cool object',
+ like_this_long_one: 'likeThisLongOne',
+ });
+ });
+
+ it('returns an empty object if there are no keys', () => {
+ ['', {}, [], null].forEach(badObj => {
+ expect(commonUtils.convertObjectPropsToSnakeCase(badObj)).toEqual({});
+ });
+ });
+ });
+
describe('with options', () => {
const objWithoutChildren = {
project_name: 'GitLab CE',