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' }) }) })