Files
open-safetylog-ehs/src/lib/dates.test.ts
T
jayjennings a382fa904a
CI / Lint, typecheck, test, build (push) Canceled after 0s
CI / End-to-end tests (push) Canceled after 0s
feat: initialize project structure with core components and pages
- Added shared styles for UI components in `src/components/styles.ts`.
- Created configuration constants in `src/lib/config.ts`.
- Implemented date formatting and greeting functions in `src/lib/dates.ts` and corresponding tests in `src/lib/dates.test.ts`.
- Developed incident management functions in `src/lib/incidents.ts` with tests in `src/lib/incidents.test.ts`.
- Established navigation structure in `src/lib/navigation.ts`.
- Seeded demo data for incidents and users in `src/lib/seed.ts`.
- Defined tone classes for UI elements in `src/lib/tones.ts`.
- Created type definitions for incidents and related entities in `src/lib/types.ts`.
- Set up main application entry point in `src/main.tsx`.
- Developed various pages including About, Analytics, Incidents, Locations, Overview, and Report Incident.
- Configured testing setup in `src/test/setup.ts` and TypeScript configurations.
- Integrated Vite for development and testing with appropriate plugins.
2026-10-06 10:07:57 -07:00

19 lines
643 B
TypeScript

import { describe, expect, it } from 'vitest'
import { formatDate, greeting, toIsoDate } from './dates'
describe('dates', () => {
it('formats ISO dates without time-zone drift', () => {
expect(formatDate('2024-08-28')).toBe('Aug 28, 2024')
})
it('converts a local date to an ISO calendar date', () => {
expect(toIsoDate(new Date(2024, 0, 5, 23, 59))).toBe('2024-01-05')
})
it('greets by time of day', () => {
expect(greeting(new Date(2024, 0, 1, 8))).toBe('Good morning')
expect(greeting(new Date(2024, 0, 1, 13))).toBe('Good afternoon')
expect(greeting(new Date(2024, 0, 1, 20))).toBe('Good evening')
})
})