fix: Provide a default to name if name is not present

This commit is contained in:
Pranav Raj S
2023-05-02 15:43:46 -07:00
parent 7bd400772d
commit 12f121f0d8
2 changed files with 4 additions and 1 deletions

View File

@@ -143,6 +143,9 @@ describe('#capitalizeName', () => {
const string = 'john peter';
expect(capitalizeName(string)).toBe('John Peter');
});
it('returns empty string if the name is null', () => {
expect(capitalizeName(null)).toBe('');
});
it('capitalize first name if full name is passed', () => {
const string = 'john Doe';
expect(capitalizeName(string)).toBe('John Doe');