Write more tests (#8799)
This commit is contained in:
committed by
GitHub
parent
b857d45182
commit
38b83f0866
@ -0,0 +1,25 @@
|
||||
import { castToString } from '../castToString';
|
||||
|
||||
it('returns an empty string when undefined is provided', () => {
|
||||
expect(castToString(undefined)).toBe('');
|
||||
});
|
||||
|
||||
it('returns an empty string when null is provided', () => {
|
||||
expect(castToString(undefined)).toBe('');
|
||||
});
|
||||
|
||||
it('returns an empty string when an empty string is provided', () => {
|
||||
expect(castToString('')).toBe('');
|
||||
});
|
||||
|
||||
it('preserves strings', () => {
|
||||
expect(castToString('test')).toBe('test');
|
||||
});
|
||||
|
||||
it('casts numbers to strings', () => {
|
||||
expect(castToString(21)).toBe('21');
|
||||
});
|
||||
|
||||
it('casts booleans to strings', () => {
|
||||
expect(castToString(true)).toBe('true');
|
||||
});
|
||||
Reference in New Issue
Block a user