import assert from 'node:assert/strict' import test from 'node:test' import type { CertificateStatistics } from '../src/api/pl/quota-cert' import { certListStatus, linkLabel, scopeStatusLabel, usageTrackingRows } from '../src/views/m/pl/plan-cert/usage-model' test('certificate usage rows keep the contract number, model, party and address from the web detail', () => { const detail = { contracts: [ { id: 'contract', contractNo: 'SX-1', products: [{ contractProductId: 'product', model: '98%' }] } ], usageItems: [ { id: 'line', contractId: 'contract', contractProductId: 'product', planNo: 'PO-1', stopType: 'delivery', productName: '硫酸', partyName: '送货方', address: '仓库', itemStatus: 'settled' } ] } as CertificateStatistics const [row] = usageTrackingRows(detail) assert.equal(row.contractNo, 'SX-1') assert.equal(row.productModel, '98%') assert.equal(row.partyName, '送货方') assert.equal(row.address, '仓库') assert.equal(certListStatus(row.itemStatus), '已核销') assert.equal(linkLabel('active'), '可安排用证') assert.equal(linkLabel('inactive'), '停止新增使用') assert.equal(scopeStatusLabel(null), '历史解绑') })