- Added new modules for managing employees and logistics, including routes for creating, editing, and viewing employee details and logistics cycles. - Implemented UI components for employee forms and detail views, with validation schemas for employee data. - Integrated language support for English and Indonesian in the new modules. - Developed unit tests for employee remote data services and transformers to ensure functionality and reliability. This commit enhances the application by providing structured management for employees and logistics, improving user experience and data handling.
33 lines
1018 B
TypeScript
33 lines
1018 B
TypeScript
import { describe, expect, it } from 'vitest';
|
|
import { formatDateValue, parseDateValue } from './date-value';
|
|
|
|
describe('parseDateValue', () => {
|
|
it('returns null for empty values', () => {
|
|
expect(parseDateValue(null)).toBeNull();
|
|
expect(parseDateValue(undefined)).toBeNull();
|
|
expect(parseDateValue('')).toBeNull();
|
|
});
|
|
|
|
it('parses YYYY-MM-DD strings', () => {
|
|
const date = parseDateValue('2026-01-12');
|
|
expect(date).toBeInstanceOf(Date);
|
|
expect(formatDateValue(date)).toBe('2026-01-12');
|
|
});
|
|
|
|
it('parses unix milliseconds', () => {
|
|
const date = parseDateValue(new Date(2026, 0, 12).getTime());
|
|
expect(formatDateValue(date)).toBe('2026-01-12');
|
|
});
|
|
});
|
|
|
|
describe('formatDateValue', () => {
|
|
it('formats a Date as YYYY-MM-DD', () => {
|
|
expect(formatDateValue(new Date(2026, 0, 12))).toBe('2026-01-12');
|
|
});
|
|
|
|
it('returns an empty string for empty values', () => {
|
|
expect(formatDateValue(null)).toBe('');
|
|
expect(formatDateValue(undefined)).toBe('');
|
|
});
|
|
});
|