Files
shanxia2.0/web-admin/src/utils/pl-plan-list-tabs.test.ts
T
zlwuandCursor 01946dde8e feat(web-admin): add arranged tab to transport plan list filters
Insert「已安排」after「待安排」in PL_PLAN_LIST_TABS and map it to followStatus=arranged.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-04 17:34:34 +08:00

54 lines
1.7 KiB
TypeScript

import assert from 'node:assert/strict'
import { describe, it } from 'node:test'
import {
PL_PLAN_LIST_TABS,
isPlPlanFollowStatusListTab,
plPlanListTabToFilters
} from './pl-display'
describe('PL_PLAN_LIST_TABS', () => {
it('places arranged immediately after pending_arrange', () => {
const names = PL_PLAN_LIST_TABS.map((t) => t.name)
assert.deepEqual(names.slice(0, 3), ['pending_arrange', 'arranged', 'drafting'])
assert.equal(
PL_PLAN_LIST_TABS.find((t) => t.name === 'arranged')?.label,
'已安排'
)
})
})
describe('isPlPlanFollowStatusListTab', () => {
it('recognizes pending_arrange, arranged, drafting', () => {
assert.equal(isPlPlanFollowStatusListTab('pending_arrange'), true)
assert.equal(isPlPlanFollowStatusListTab('arranged'), true)
assert.equal(isPlPlanFollowStatusListTab('drafting'), true)
assert.equal(isPlPlanFollowStatusListTab('all'), false)
assert.equal(isPlPlanFollowStatusListTab('inbound'), false)
})
})
describe('plPlanListTabToFilters', () => {
it('maps arranged to followStatus arranged with empty planType', () => {
assert.deepEqual(plPlanListTabToFilters('arranged'), {
planType: '',
followStatus: 'arranged'
})
})
it('keeps pending_arrange and drafting behavior', () => {
assert.deepEqual(plPlanListTabToFilters('pending_arrange'), {
planType: '',
followStatus: 'pending_arrange'
})
assert.deepEqual(plPlanListTabToFilters('drafting'), {
planType: '',
followStatus: 'drafting'
})
})
it('maps type tabs without followStatus', () => {
assert.deepEqual(plPlanListTabToFilters('all'), { planType: '' })
assert.deepEqual(plPlanListTabToFilters('inbound'), { planType: 'inbound' })
})
})