优化
This commit is contained in:
@@ -10,11 +10,11 @@ import { overseasWarehousePermissions as permission } from '../permissions'
|
||||
import type { CargoDiscardDetail, CargoDiscardSummary } from '../api/cargoDiscards'
|
||||
import CargoDiscardsView from './CargoDiscardsView.vue'
|
||||
|
||||
const api = vi.hoisted(() => ({ customers: vi.fn(), list: vi.fn(), detail: vi.fn(), review: vi.fn(), photo: vi.fn() }))
|
||||
const api = vi.hoisted(() => ({ customers: vi.fn(), list: vi.fn(), detail: vi.fn(), review: vi.fn(), photo: vi.fn(), statistics: vi.fn() }))
|
||||
const can = vi.hoisted(() => vi.fn((_code: string) => true))
|
||||
vi.mock('@/core/access/accessPreview', () => ({ useAccessPreviewStore: () => ({ can }) }))
|
||||
vi.mock('@/modules/iam', () => ({ listPlatformTenants: api.customers }))
|
||||
vi.mock('../api/cargoDiscards', () => ({ listCargoDiscards: api.list, getCargoDiscard: api.detail, reviewCargoDiscard: api.review, downloadCargoDiscardPhoto: api.photo }))
|
||||
vi.mock('../api/cargoDiscards', () => ({ listCargoDiscards: api.list, getCargoDiscard: api.detail, reviewCargoDiscard: api.review, downloadCargoDiscardPhoto: api.photo, getCargoDiscardStatistics: api.statistics }))
|
||||
|
||||
enableAutoUnmount(afterEach)
|
||||
afterEach(() => { ElMessageBox.close(); vi.unstubAllGlobals() })
|
||||
@@ -25,6 +25,7 @@ beforeEach(() => {
|
||||
vi.resetAllMocks(); can.mockReturnValue(true)
|
||||
vi.stubGlobal('ResizeObserver', class { observe() {} unobserve() {} disconnect() {} })
|
||||
api.customers.mockResolvedValue({ records: [{ id: '9007199254740994', tenantName: '客户一' }] })
|
||||
api.statistics.mockResolvedValue({ orderCount: 1, skuCount: 1, requestedPackages: 2, actualPackages: null, requestedPieces: null, actualPieces: null, palletCount: null })
|
||||
api.list.mockResolvedValue({ records: [summary()], total: 1 })
|
||||
api.detail.mockImplementation(async () => detail()); api.review.mockResolvedValue(detail())
|
||||
api.photo.mockResolvedValue(new Blob(['image'], { type: 'image/png' }))
|
||||
|
||||
Reference in New Issue
Block a user