Files
goodgo-platform/apps/web/components/ui/__tests__/textarea.spec.tsx
Ho Ngoc Hai ccb82fddf8 feat(cache): implement Redis caching for search & analytics hot paths
- Add TTL-specific cache durations: district stats (5min), market report (15min), heatmap (5min)
- Add Redis caching to GeoSearch handler with 60s TTL
- Add cache invalidation on listing.approved, listing.updated, listing.deactivated, listing.sold events
- Invalidate search, geo_search, and all analytics cache prefixes on listing state changes
- Update tests for new CacheService dependency in event handler and geo-search handler

Co-Authored-By: Paperclip <noreply@paperclip.ing>
2026-04-08 22:51:16 +07:00

29 lines
1.0 KiB
TypeScript

import { render, screen } from '@testing-library/react';
import userEvent from '@testing-library/user-event';
import { describe, expect, it } from 'vitest';
import { Textarea } from '../textarea';
describe('Textarea', () => {
it('renders a textarea element', () => {
render(<Textarea placeholder="Mô tả" />);
expect(screen.getByPlaceholderText('Mô tả')).toBeInTheDocument();
});
it('accepts typed input', async () => {
render(<Textarea placeholder="Nhập nội dung" />);
const textarea = screen.getByPlaceholderText('Nhập nội dung');
await userEvent.type(textarea, 'Test content');
expect(textarea).toHaveValue('Test content');
});
it('is disabled when disabled prop is set', () => {
render(<Textarea disabled placeholder="Disabled" />);
expect(screen.getByPlaceholderText('Disabled')).toBeDisabled();
});
it('applies custom className', () => {
render(<Textarea className="tall" placeholder="Custom" />);
expect(screen.getByPlaceholderText('Custom')).toHaveClass('tall');
});
});