fix: throw error instead of returning it (#1624)

This commit is contained in:
Piotr Idzik
2024-02-29 05:55:11 +01:00
committed by GitHub
parent c067a34fae
commit a5945e37c2
7 changed files with 19 additions and 3 deletions

View File

@ -15,4 +15,8 @@ describe('checkCamelCase', () => {
const result = checkCamelCase(value)
expect(result).toBe(false)
})
it('should throw when input is not a string', () => {
expect(() => checkCamelCase(100)).toThrowError()
})
})

View File

@ -15,4 +15,8 @@ describe('checkFlatCase function', () => {
const actual = checkFlatCase('abcdefghijklmnopqrstuvwxyz')
expect(actual).toBe(true)
})
it('should throw when input is not a string', () => {
expect(() => checkFlatCase(100)).toThrowError()
})
})

View File

@ -11,3 +11,7 @@ test('CheckKebabCase(The Algorithms) -> false', () => {
const res = CheckKebabCase(word)
expect(res).toBeFalsy()
})
test('CheckKebabCase throws when input is not a string', () => {
expect(() => CheckKebabCase(100)).toThrowError()
})

View File

@ -17,3 +17,7 @@ test('CheckPascalCase(The Algorithms) -> false', () => {
const res = CheckPascalCase(word)
expect(res).toBeFalsy()
})
test('CheckPascalCase throws when input is not a string', () => {
expect(() => CheckPascalCase(100)).toThrowError()
})