Files
zkxw/web-admin/src/utils/production-work-order-tabs.test.ts
T
zlwuandCursor 8349b0ce73 fix(web-admin): 隐藏生产/质检中试服务 Tab 并从「所有」排除 (#160)
客户已下线中试业务:侧栏不再展示中试 Tab,前端在「所有」列表过滤出库中试数据(含 bizType 缺省)。

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-11-20 14:48:58 +08:00

33 lines
1.5 KiB
TypeScript

import { describe, it } from 'node:test'
import assert from 'node:assert/strict'
import {
PRODUCTION_WORK_ORDER_VISIBLE_TABS,
parseProductionWorkOrderTabKey,
workOrderMatchesTab,
isPilotServiceOutboundWorkOrder
} from './production-work-order-tabs'
import { PRODUCTION_WORK_ORDER_CATEGORY_OPTIONS } from './production-work-order-category'
describe('production work order tabs — hide pilot service', () => {
it('visible tabs exclude outbound_pilot_service', () => {
assert.ok(!PRODUCTION_WORK_ORDER_VISIBLE_TABS.some((t) => t.key === 'outbound_pilot_service'))
assert.ok(!PRODUCTION_WORK_ORDER_CATEGORY_OPTIONS.some((o) => o.key === 'outbound_pilot_service'))
})
it('parse: hidden pilot key and outbound alias fall back safely', () => {
assert.equal(parseProductionWorkOrderTabKey('outbound_pilot_service'), 'all')
assert.equal(parseProductionWorkOrderTabKey('outbound'), 'outbound_basic_experiment')
})
it('「所有」excludes pilot outbound (incl. default bizType)', () => {
const pilot = { workOrderType: 'outbound', bizType: 'pilot_service' }
const defaultPilot = { workOrderType: 'outbound' }
const basic = { workOrderType: 'outbound', bizType: 'basic_experiment' }
assert.equal(isPilotServiceOutboundWorkOrder(pilot), true)
assert.equal(isPilotServiceOutboundWorkOrder(defaultPilot), true)
assert.equal(workOrderMatchesTab(pilot as any, 'all'), false)
assert.equal(workOrderMatchesTab(defaultPilot as any, 'all'), false)
assert.equal(workOrderMatchesTab(basic as any, 'all'), true)
})
})