@cc-heart/utils
Version:
🔧 javascript common tools collection
17 lines (16 loc) • 769 B
text/typescript
import { underlineToHump } from '../../../lib/underlineToHump'
describe('underlineToHump', () => {
it('should convert underline string to hump string', () => {
expect(underlineToHump('hello_world')).toBe('helloWorld')
expect(underlineToHump('my_name_is_john')).toBe('myNameIsJohn')
expect(underlineToHump('_private_variable')).toBe('_privateVariable')
})
it('should not convert double underline to hump', () => {
expect(underlineToHump('hello__world')).toBe('hello__world')
expect(underlineToHump('my__name_is_john')).toBe('my__nameIsJohn')
})
it('should not convert start underline to hump', () => {
expect(underlineToHump('_hello_world')).toBe('_helloWorld')
expect(underlineToHump('__hello_world')).toBe('__helloWorld')
})
})