This commit is contained in:
@@ -149,6 +149,7 @@ const lastResultState = (wrapper: ReturnType<typeof mount>) => (
|
||||
categoryId: string
|
||||
keyword: string
|
||||
pending?: boolean
|
||||
requestId?: number
|
||||
}
|
||||
)
|
||||
|
||||
@@ -323,6 +324,36 @@ describe('PoiSearchPanel 搜索状态契约', () => {
|
||||
wrapper.unmount()
|
||||
})
|
||||
|
||||
it('首页分类结果在组件重挂载后仍发送递增的跨组件版本号', async () => {
|
||||
const firstWrapper = mount(PoiSearchPanel, {
|
||||
props: {
|
||||
variant: 'home',
|
||||
currentFloorId: 'floor-1',
|
||||
currentFloorLabel: '1F'
|
||||
}
|
||||
})
|
||||
await flushMountedSearch()
|
||||
await firstWrapper.get('[data-testid="poi-category-restroom"]').trigger('tap')
|
||||
await flushMountedSearch()
|
||||
const firstRequestId = lastResultState(firstWrapper).requestId
|
||||
firstWrapper.unmount()
|
||||
|
||||
const secondWrapper = mount(PoiSearchPanel, {
|
||||
props: {
|
||||
variant: 'home',
|
||||
currentFloorId: 'floor-1',
|
||||
currentFloorLabel: '1F'
|
||||
}
|
||||
})
|
||||
await flushMountedSearch()
|
||||
await secondWrapper.get('[data-testid="poi-category-restroom"]').trigger('tap')
|
||||
await flushMountedSearch()
|
||||
|
||||
expect(firstRequestId).toEqual(expect.any(Number))
|
||||
expect(lastResultState(secondWrapper).requestId).toBeGreaterThan(firstRequestId as number)
|
||||
secondWrapper.unmount()
|
||||
})
|
||||
|
||||
it('首页快捷分类请求期间清空列表并下发 pending 空地图 ID', async () => {
|
||||
const initialState = createSearchState()
|
||||
const deferredCategory = createDeferred<GuidePoiSearchViewState>()
|
||||
|
||||
Reference in New Issue
Block a user