-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
525 additions
and
10 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import { addSeparators, pluralize } from '../utils'; | ||
|
||
describe('utils', () => { | ||
describe('addSeparators', () => { | ||
it('should return one word without separators', () => { | ||
expect(addSeparators(['test'])).toBe('test'); | ||
}); | ||
|
||
it('should return two words separated with `and`', () => { | ||
expect(addSeparators(['test1', 'test2'], 'and')).toBe('test1 and test2'); | ||
}); | ||
|
||
it('should return three words separated with comma and `and`', () => { | ||
expect(addSeparators(['test1', 'test2', 'test3'], 'and')).toBe('test1, test2 and test3'); | ||
}); | ||
|
||
it('should return multiple words separated with comma and `and` as last separator', () => { | ||
expect(addSeparators(['test1', 'test2', 'test3', 'test4', 'test5'], 'and')).toBe( | ||
'test1, test2, test3, test4 and test5', | ||
); | ||
}); | ||
}); | ||
|
||
describe('pluralize', () => { | ||
it('should return singular', () => { | ||
expect(pluralize(1, 'test', 'tests')).toBe('test'); | ||
}); | ||
|
||
it('should return plural', () => { | ||
expect(pluralize(2, 'test', 'tests')).toBe('tests'); | ||
}); | ||
}); | ||
}); |
Oops, something went wrong.