import { readFileSync } from 'fs'; import { describe, expect, it } from 'vitest'; const wxml = readFileSync( new URL('../../miniprogram/components/picking-panel/index.wxml', import.meta.url), 'utf8' ); const js = readFileSync( new URL('../../miniprogram/components/picking-panel/index.js', import.meta.url), 'utf8' ); describe('小程序分拣范围选择框', () => { it('页内点击选范围:按订单/分类/商品都走选择框;完成组不占位', () => { expect(wxml).not.toContain('scroll-x class="task-tabs"'); expect(wxml).toContain('toggleScopeMenu'); expect(wxml).toContain('scope-menu'); expect(wxml).toContain('wx:if="{{scopeGroups.length}}"'); expect(wxml).not.toContain('!skuCatalogMode'); expect(js).toContain('function groupStillOpen'); expect(js).toContain('onScopeOptionTap'); expect(js).toContain('scopeMenuOpen'); expect(js).toContain("if (type === 'category') return String(task.scope_label"); expect(js).toContain("if (type === 'sku') return String(task.scope_label"); // 区域模式:选择器/分组标签必须显示区域名,不得落到兜底显示订单号(2026-10-13 修) expect(js).toContain("if (type === 'zone') return String(task.scope_label"); expect(js).toContain("if (type === 'category' || type === 'sku' || type === 'zone')"); expect(js).toContain('this.selectGroupByKey(activeGroupKey)'); expect(js).not.toContain('this.applyPickingDayView()'); }); it('日期轴仍在;小程序打印走 BLE 新通道(2026-10-13 起)', () => { expect(wxml).toContain('date-axis'); expect(js).toContain('confirmAllPicks'); // 2026-10-13 开发者要求重新加回分拣「打印」:走 **BLE 热敏直连**(utils/pickingLabelPrint), // 仍**不走**旧 print_jobs / 称重终端链路(无 printPickLabels / 设备下发)。 expect(wxml).toContain('printCurrentPick'); expect(wxml).toContain('btn-print-row'); expect(js).toContain('printCurrentPick'); expect(js).toContain('pickingLabelPrint'); expect(js).not.toContain('printPickLabels'); expect(js).not.toContain('fetchPickingWeighDevices'); expect(js).not.toContain('createPickingPrintJobs'); }); });