Files
twenty_crm/packages/twenty-front/src/utils/__tests__/castToString.test.ts
2024-11-28 17:43:15 +01:00

26 lines
637 B
TypeScript

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');
});