Skip to content

Commit

Permalink
test: dashToCamelCase string util
Browse files Browse the repository at this point in the history
Signed-off-by: abizek <abishekilango@protonmail.com>
  • Loading branch information
abizek committed May 21, 2024
1 parent 2064c3d commit 504dddd
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions util/__tests__/stringUtils.test.mjs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import {
getAcronymFromString,
parseRichTextIntoPlainText,
dashToCamelCase,
} from '@/util/stringUtils';

describe('String utils', () => {
Expand Down Expand Up @@ -59,4 +60,16 @@ describe('String utils', () => {
const result = parseRichTextIntoPlainText(richText);
expect(result).toBe('Line 1\nLine 2\nLine 3');
});

it('dashToCamelCase returns correct camelCase', () => {
expect(dashToCamelCase('foo-bar-baz')).toBe('fooBarBaz');
});

it('dashToCamelCase returns correct camelCase with capital first letter', () => {
expect(dashToCamelCase('Foo-bar')).toBe('fooBar');
});

it('dashToCamelCase returns correct camelCase with numbers', () => {
expect(dashToCamelCase('foo-123-bar')).toBe('foo123Bar');
});
});

0 comments on commit 504dddd

Please sign in to comment.