feat(FEAT-MO-005): 展示市场结构与成交额趋势
This commit is contained in:
@@ -50,4 +50,28 @@ describe('市场概览状态', () => {
|
||||
expect(second.analysisHorizon.value).toBe('短线');
|
||||
expect(second.analysisEngine.value).toBe('混合');
|
||||
});
|
||||
|
||||
it('切换行业结构分类时重新请求对应数据', async () => {
|
||||
const api = {
|
||||
getSectorRankings: vi.fn().mockResolvedValue(response),
|
||||
getCapitalFlow: vi.fn().mockResolvedValue(response),
|
||||
};
|
||||
const state = useMarketOverview(api as never);
|
||||
|
||||
await state.refreshSectorRankings('concept');
|
||||
await state.refreshCapitalFlow('board');
|
||||
|
||||
expect(api.getSectorRankings).toHaveBeenCalledWith({
|
||||
category: 'concept',
|
||||
sort: 'rise',
|
||||
limit: 10,
|
||||
});
|
||||
expect(api.getCapitalFlow).toHaveBeenCalledWith({
|
||||
category: 'board',
|
||||
sort: 'inflow',
|
||||
limit: 10,
|
||||
});
|
||||
expect(state.sectorCategory.value).toBe('concept');
|
||||
expect(state.capitalFlowCategory.value).toBe('board');
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user