-
Notifications
You must be signed in to change notification settings - Fork 556
fix(trimStart): add missing multi-character string validation #1615
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 1 commit
1e15a88
30d52b2
3174511
9655554
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -46,6 +46,10 @@ describe('trimStart', () => { | |
| expect(trimStart(' hello world ')).toEqual('hello world '); | ||
| }); | ||
|
|
||
| it('should throw an error when chars is a multi-character string', () => { | ||
| expect(() => trimStart('---hello', '--')).toThrow(); | ||
| }); | ||
|
Comment on lines
+49
to
+51
|
||
|
|
||
| it('should remove leading characters when chars is an array', () => { | ||
| expect(trimStart('---hello', ['-', 'h'])).toEqual('ello'); | ||
| }); | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The test should verify the exact error message for consistency with the trimEnd tests. The trimEnd.spec.ts file (line 66) tests the exact error message with:
expect(() => trimEnd('hello', 'ab')).toThrow(\The 'chars' parameter should be a single character string.`);` This test should follow the same pattern.