fix: valuation page Vietnamese diacritics, correct API routes, update tests
- Add proper Vietnamese diacritics to all valuation components (form, results, history) and their test assertions - Fix valuation API client to use /analytics/valuation endpoint - Return empty history gracefully (no server endpoint yet) Co-Authored-By: Claude Opus 4 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -43,7 +43,7 @@ const mockResult: ValuationResult = {
|
||||
describe('ValuationResults', () => {
|
||||
it('renders estimated price', () => {
|
||||
render(<ValuationResults result={mockResult} />);
|
||||
expect(screen.getByText('5.00 ty VND')).toBeInTheDocument();
|
||||
expect(screen.getByText('5.00 tỷ VNĐ')).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('renders confidence percentage', () => {
|
||||
@@ -53,17 +53,17 @@ describe('ValuationResults', () => {
|
||||
|
||||
it('renders price per m2', () => {
|
||||
render(<ValuationResults result={mockResult} />);
|
||||
expect(screen.getByText('62.5 tr/m2')).toBeInTheDocument();
|
||||
expect(screen.getByText('62.5 tr/m²')).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('renders price range', () => {
|
||||
render(<ValuationResults result={mockResult} />);
|
||||
expect(screen.getByText(/4\.50 ty.*5\.50 ty/)).toBeInTheDocument();
|
||||
expect(screen.getByText(/4\.50 tỷ.*5\.50 tỷ/)).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('renders price drivers section', () => {
|
||||
render(<ValuationResults result={mockResult} />);
|
||||
expect(screen.getByText('Yeu to anh huong gia')).toBeInTheDocument();
|
||||
expect(screen.getByText('Yếu tố ảnh hưởng giá')).toBeInTheDocument();
|
||||
expect(screen.getByText('Vị trí trung tâm')).toBeInTheDocument();
|
||||
expect(screen.getByText('Tầng thấp')).toBeInTheDocument();
|
||||
});
|
||||
@@ -80,31 +80,31 @@ describe('ValuationResults', () => {
|
||||
|
||||
it('renders comparables section', () => {
|
||||
render(<ValuationResults result={mockResult} />);
|
||||
expect(screen.getByText('Bat dong san tuong tu')).toBeInTheDocument();
|
||||
expect(screen.getByText('Bất động sản tương tự')).toBeInTheDocument();
|
||||
expect(screen.getByText('Căn hộ tương tự A')).toBeInTheDocument();
|
||||
expect(screen.getByText('Căn hộ tương tự B')).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('shows comparable count', () => {
|
||||
render(<ValuationResults result={mockResult} />);
|
||||
expect(screen.getByText(/2 bat dong san/)).toBeInTheDocument();
|
||||
expect(screen.getByText(/2 bất động sản/)).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('shows similarity percentage for comparables', () => {
|
||||
render(<ValuationResults result={mockResult} />);
|
||||
expect(screen.getByText('92% tuong tu')).toBeInTheDocument();
|
||||
expect(screen.getByText('85% tuong tu')).toBeInTheDocument();
|
||||
expect(screen.getByText('92% tương tự')).toBeInTheDocument();
|
||||
expect(screen.getByText('85% tương tự')).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('hides drivers section when empty', () => {
|
||||
const noDrivers = { ...mockResult, priceDrivers: [] };
|
||||
render(<ValuationResults result={noDrivers} />);
|
||||
expect(screen.queryByText('Yeu to anh huong gia')).not.toBeInTheDocument();
|
||||
expect(screen.queryByText('Yếu tố ảnh hưởng giá')).not.toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('hides comparables section when empty', () => {
|
||||
const noComps = { ...mockResult, comparables: [] };
|
||||
render(<ValuationResults result={noComps} />);
|
||||
expect(screen.queryByText('Bat dong san tuong tu')).not.toBeInTheDocument();
|
||||
expect(screen.queryByText('Bất động sản tương tự')).not.toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user