admin/features/events/eventCardLabels.test.ts
alisaza e1eaf5eff5 feat: initial ghabilee-admin backoffice app
Extract admin dashboard from ghabilee-frontend2 into a dedicated Next.js
app for backoffice.ghabilee.ir (no SEO indexing / Clarity).
2026-09-05 13:12:59 +03:30

30 lines
962 B
TypeScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import { describe, expect, it } from 'vitest'
import {
formatEventCardClockLabel,
formatEventCardDateLabel,
formatEventCardPriceLabel,
formatEventCardTimeRange,
} from '@/features/events/eventCardLabels'
import { texts } from '@/texts'
describe('eventCardLabels', () => {
it('formats weekday/long date and clock labels', () => {
const iso = '2030-07-01T10:30:00.000Z'
expect(formatEventCardDateLabel(iso)).toContain('تیر')
expect(formatEventCardClockLabel(iso).length).toBeGreaterThan(0)
})
it('formats a startend time range', () => {
const label = formatEventCardTimeRange('2030-07-01T10:00:00.000Z', '2030-07-01T14:00:00.000Z')
expect(label).toContain('تا')
})
it('formats free vs paid price labels', () => {
expect(formatEventCardPriceLabel({ isFree: true, price: 0 })).toBe(texts.events.free)
expect(formatEventCardPriceLabel({ isFree: false, price: 150_000 })).not.toBe(texts.events.free)
})
})