-
-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
create a isString helper to avoid code duplication (#1763)
* create a isString helper to avoid code duplication * add test
- Loading branch information
1 parent
46e8ea5
commit a904e07
Showing
4 changed files
with
33 additions
and
16 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { describe, it, expect } from 'vitest'; | ||
import { isString } from '../src/utils.js'; | ||
|
||
describe('isString', () => { | ||
it('should return true for strings', () => { | ||
expect(isString('string')).toBe(true); | ||
}); | ||
|
||
it.each([[undefined], [null], [1], [{}], [[]], [() => {}]])( | ||
'should return false for non-strings, testing %o', | ||
(value) => { | ||
expect(isString(value)).toBe(false); | ||
}, | ||
); | ||
}); |