summaryrefslogtreecommitdiff
path: root/spec/javascripts/lib/utils/text_utility_spec.js
diff options
context:
space:
mode:
Diffstat (limited to 'spec/javascripts/lib/utils/text_utility_spec.js')
-rw-r--r--spec/javascripts/lib/utils/text_utility_spec.js23
1 files changed, 23 insertions, 0 deletions
diff --git a/spec/javascripts/lib/utils/text_utility_spec.js b/spec/javascripts/lib/utils/text_utility_spec.js
index 1f46c225071..5615657fcff 100644
--- a/spec/javascripts/lib/utils/text_utility_spec.js
+++ b/spec/javascripts/lib/utils/text_utility_spec.js
@@ -62,4 +62,27 @@ describe('text_utility', () => {
expect(textUtils.slugify('João')).toEqual('joão');
});
});
+
+ describe('camelCase', () => {
+ it('converts a snake_case string to camelCase', () => {
+ expect(textUtils.camelCase('snake_case_string')).toEqual('snakeCaseString');
+ });
+
+ it('converts string with numbers', () => {
+ expect(textUtils.camelCase('test1twothree')).toEqual('test1twothree');
+ });
+ });
+
+ describe('camelCaseKeys', () => {
+ it('converts object keys to camelCase', () => {
+ const input = {
+ my_key: 'some_value',
+ };
+ const expected = {
+ myKey: 'some_value',
+ };
+
+ expect(textUtils.camelCaseKeys(input)).toEqual(expected);
+ });
+ });
});