import { mount } from '@vue/test-utils'
import { nextTick } from 'vue'
import { beforeEach, describe, expect, it, vi } from 'vitest'
import PalletLabelPrintDialog from './PalletLabelPrintDialog.vue'
const preparePalletLabels = vi.fn()
vi.mock('../api/platformLoadingLists', () => ({
preparePalletLabels: (...args: unknown[]) => preparePalletLabels(...args),
printPalletLabels: vi.fn(),
}))
describe('PalletLabelPrintDialog', () => {
beforeEach(() => {
preparePalletLabels.mockReset().mockResolvedValue({
planId: '10', planNo: 'LP-1', containerNo: 'HLCU1723867', totalCount: 2,
groups: [{
destinationWarehouseCode: 'ACY2', destinationWarehouseInternalCode: '101',
destinationWarehouseName: 'ACY2', totalCount: 2,
labels: [
{ palletCode: 'HLCU1723867-101-001' },
{ palletCode: 'HLCU1723867-101-002' },
],
}],
})
})
it('shows the server-generated internal code rule and both warehouse codes', async () => {
const wrapper = mount(PalletLabelPrintDialog, {
props: { planId: '10', warehouseId: '20' },
global: {
stubs: {
AppDialog: { template: '
{{ title }}
' }, 'el-radio-group': { template: '