You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

date.test.ts 551 B

1234567891011121314151617181920212223
  1. import { canBeConvertToDate } from '../src/utils/date';
  2. describe('test canBeConvertToDate()', () => {
  3. test('null', () => {
  4. expect(canBeConvertToDate(null)).toBe(false);
  5. });
  6. test('undefined', () => {
  7. expect(canBeConvertToDate(undefined)).toBe(false);
  8. });
  9. test('empty string', () => {
  10. expect(canBeConvertToDate('')).toBe(false);
  11. });
  12. test('valid string', () => {
  13. expect(canBeConvertToDate('2024-10-10T10:10:10+08:00')).toBe(true);
  14. });
  15. test('numeric', () => {
  16. expect(canBeConvertToDate(0)).toBe(true);
  17. });
  18. });