feat(FEAT-MO-001): 完成TDX市场概览首屏

This commit is contained in:
2026-08-18 15:28:35 +08:00
parent 27bc3c198f
commit 82619489a9
38 changed files with 1230 additions and 54 deletions
+23 -2
View File
@@ -1,11 +1,32 @@
import { createPinia } from 'pinia';
import { mount } from '@vue/test-utils';
import { createMemoryHistory } from 'vue-router';
import { describe, expect, it } from 'vitest';
import { describe, expect, it, vi } from 'vitest';
import App from './App.vue';
import { createAppRouter } from './router';
// 应用外壳测试只验证导航和主区域,不应因页面挂载触发真实 Axios 请求。
vi.mock('@/api/market-overview', () => {
const response = {
source: 'tdx',
status: 'unavailable',
data: null,
snapshotId: 'test',
asOf: '2026-08-18T00:00:00.000Z',
warnings: ['测试环境未连接 TDX'],
};
return {
default: {
getSummary: vi.fn().mockResolvedValue(response),
getIndices: vi.fn().mockResolvedValue(response),
getBreadth: vi.fn().mockResolvedValue(response),
getSectors: vi.fn().mockResolvedValue(response),
getFunds: vi.fn().mockResolvedValue(response),
},
};
});
describe('应用外壳', () => {
it('提供可访问的应用标题和主内容区域', async () => {
const router = createAppRouter(createMemoryHistory());
@@ -21,6 +42,6 @@ describe('应用外壳', () => {
expect(wrapper.get('header').attributes('aria-label')).toBe('应用导航');
expect(wrapper.get('main').attributes('id')).toBe('main-content');
expect(wrapper.text()).toContain('A 股市场分析工具');
expect(wrapper.text()).toContain('工程基线已就绪');
expect(wrapper.text()).toContain('市场综合概览');
});
});