优化
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import ElementPlus from 'element-plus'
|
||||
import { enableAutoUnmount, flushPromises, mount } from '@vue/test-utils'
|
||||
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
|
||||
import { reactive } from 'vue'
|
||||
import { reactive, ref } from 'vue'
|
||||
import { ApiResponseError } from '@/shared/api/http'
|
||||
import BusinessDocumentFees from '../components/BusinessDocumentFees.vue'
|
||||
import { getLocalLooseboardOrder } from '../api/platformOverseasBusiness'
|
||||
@@ -36,6 +36,22 @@ beforeEach(() => {
|
||||
})
|
||||
|
||||
describe('looseboard document fees', () => {
|
||||
it('refreshes the current status when returning to a cached document tab', async () => {
|
||||
const visible = ref(true)
|
||||
vi.mocked(getLocalLooseboardOrder).mockResolvedValueOnce(order({ status: 'WAITING_INBOUND' }))
|
||||
.mockResolvedValueOnce(order({ status: 'PENDING_DISPATCH' }))
|
||||
const wrapper = mount({ components: { LooseboardOrderDetailView }, setup: () => ({ visible }),
|
||||
template: '<KeepAlive><LooseboardOrderDetailView v-if="visible" /></KeepAlive>',
|
||||
}, { global: { plugins: [ElementPlus], stubs: { BusinessDocumentFees: true, FleetArrangementSummary: true, DataTable: true } } })
|
||||
await flushPromises()
|
||||
expect(getLocalLooseboardOrder).toHaveBeenCalledTimes(1)
|
||||
expect(wrapper.find('.status-badge').text()).toBe('待入仓')
|
||||
visible.value = false; await flushPromises()
|
||||
visible.value = true; await flushPromises()
|
||||
expect(getLocalLooseboardOrder).toHaveBeenCalledTimes(2)
|
||||
expect(wrapper.find('.status-badge').text()).toBe('待派车')
|
||||
})
|
||||
|
||||
it('loads the customer scoped document and passes its exact identity to fees', async () => {
|
||||
const wrapper = mountDetail(); await flushPromises()
|
||||
expect(getLocalLooseboardOrder).toHaveBeenCalledWith('LB-TEST', '9007199254741999')
|
||||
|
||||
Reference in New Issue
Block a user