-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' of github.com:elastic/kibana into add-feature-o11…
…y-server-less
- Loading branch information
Showing
66 changed files
with
2,296 additions
and
1,643 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0 and the Server Side Public License, v 1; you may not use this file except | ||
* in compliance with, at your election, the Elastic License 2.0 or the Server | ||
* Side Public License, v 1. | ||
*/ | ||
|
||
import { cleanString, lowerCaseFirstLetter } from './utils'; | ||
|
||
describe('Utils', () => { | ||
describe('lowerCaseFirstLetter', () => { | ||
it('should lowercase the first letter', () => { | ||
expect(lowerCaseFirstLetter('Hello')).toBe('hello'); | ||
expect(lowerCaseFirstLetter('GreatSuccessYes')).toBe('greatSuccessYes'); | ||
expect(lowerCaseFirstLetter('How is it going?')).toBe('how is it going?'); | ||
}); | ||
|
||
it('should lowercase all letters if the passed string is in ALL CAPS', () => { | ||
expect(lowerCaseFirstLetter('HELLO')).toBe('hello'); | ||
expect(lowerCaseFirstLetter('GREATSUCCESSYES')).toBe('greatsuccessyes'); | ||
}); | ||
}); | ||
|
||
describe('cleanString', () => { | ||
it('should remove all numbers', () => { | ||
expect(cleanString('123')).toBe(''); | ||
}); | ||
|
||
it('should remove all white spaces from beginning and end', () => { | ||
expect(cleanString(' abc ')).toBe('abc'); | ||
expect(cleanString(' This is a test ')).toBe('This is a test'); | ||
expect( | ||
cleanString(` | ||
hello | ||
great!`) | ||
).toBe('hello great'); | ||
}); | ||
|
||
it('should remove all non alphabet characters', () => { | ||
expect(cleanString('abc123!@#')).toBe('abc'); | ||
expect(cleanString('!@#$%^&*()_+{}|')).toBe(''); | ||
expect(cleanString(' Hey, this is great! Success. ')).toBe('Hey this is great Success'); | ||
}); | ||
|
||
it('should leave markdown alone', () => { | ||
expect(cleanString('```hello```')).toBe(''); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.