diff --git a/src/modules/container-loading/pages/SmartLoadingWorkbenchView.test.ts b/src/modules/container-loading/pages/SmartLoadingWorkbenchView.test.ts index 1e25c883..8cea28ba 100644 --- a/src/modules/container-loading/pages/SmartLoadingWorkbenchView.test.ts +++ b/src/modules/container-loading/pages/SmartLoadingWorkbenchView.test.ts @@ -75,7 +75,9 @@ describe('SmartLoadingWorkbenchView', () => { expect(wrapper.text()).not.toContain('LP-99') expect(wrapper.text()).toContain('IN-1') expect(wrapper.text()).not.toContain('ORD-1') - expect(wrapper.text()).toContain('150% 容量上限') + expect(wrapper.text()).not.toContain('150% 容量上限') + await wrapper.get('button[aria-label="查看装柜说明"]').trigger('mouseenter') + await vi.waitFor(() => expect(document.body.textContent).toContain('150% 容量上限')) }) it('shows the full inbound composition for an assigned sealed pallet', async () => { diff --git a/src/modules/inbounds/fee/InboundFeePanel.test.ts b/src/modules/inbounds/fee/InboundFeePanel.test.ts index c53e01cc..729132ae 100644 --- a/src/modules/inbounds/fee/InboundFeePanel.test.ts +++ b/src/modules/inbounds/fee/InboundFeePanel.test.ts @@ -235,11 +235,13 @@ describe('InboundFeePanel', () => { it('treats A0404 as a neutral not-yet-generated state', async () => { vi.mocked(getLatestInboundFee).mockRejectedValue(new ApiResponseError('费用快照不存在', 'A0404')) - mountPanel(['firstleg:fba-pricing:view']) + const wrapper = mountPanel(['firstleg:fba-pricing:view']) await flushPromises() expect(document.body.textContent).toContain('尚未生成费用快照') - expect(document.body.textContent).toContain('测量审核完成后') + expect(document.body.textContent).not.toContain('测量审核完成后') + await wrapper.get('button[aria-label="查看计费说明"]').trigger('mouseenter') + await vi.waitFor(() => expect(document.body.textContent).toContain('测量审核完成后')) expect(document.querySelector('[role="alert"]')).toBeNull() }) diff --git a/src/modules/self-operated/components/SkuTrend.test.ts b/src/modules/self-operated/components/SkuTrend.test.ts index 92eafc20..976be5fe 100644 --- a/src/modules/self-operated/components/SkuTrend.test.ts +++ b/src/modules/self-operated/components/SkuTrend.test.ts @@ -1,4 +1,5 @@ vi.mock('@/shared/components/AppDialog.vue', () => ({ default: { props: ['modelValue'], template: '
' } })) +import ElementPlus from 'element-plus' import { mount } from '@vue/test-utils' import { describe, expect, it, vi } from 'vitest' import { defineComponent } from 'vue' @@ -15,7 +16,7 @@ function data(status = 'COMPLETE'): DailyResponse { } describe('SKU daily trend axes', () => { it('shows both axes, intermediate dates, zero and maximum ticks for a 30-day window', () => { - const w = mount(SkuTrend, { props: { data: data() } }) + const w = mount(SkuTrend, { props: { data: data() }, global: { plugins: [ElementPlus] } }) const chart = w.findComponent({ name: 'VChart' }) const option = chart.props('option') expect(option.xAxis).toMatchObject({ type: 'category', name: '日期(北京时间)' }) @@ -24,11 +25,11 @@ describe('SKU daily trend axes', () => { expect(option.series[1].data).toEqual(Array(30).fill(1)) expect(option.tooltip.trigger).toBe('axis') expect(chart.props('initOptions')).toEqual({ renderer: 'canvas' }) - expect(w.find('svg').exists()).toBe(false) + expect(w.get('.sku-trend').find('svg').exists()).toBe(false) w.unmount() }) it('retains axes and date markers for an unknown window without drawing zero points', () => { - const w = mount(SkuTrend, { props: { data: data('UNKNOWN') } }) + const w = mount(SkuTrend, { props: { data: data('UNKNOWN') }, global: { plugins: [ElementPlus] } }) expect(w.text()).toContain('未知日期不作为零销量') const option = w.findComponent({ name: 'VChart' }).props('option') expect(option.series[0].data.every((point: { value: number | null }) => point.value === null)).toBe(true)