2026-08-11 20:02:04 +08:00
|
|
|
import assert from 'node:assert/strict'
|
|
|
|
|
import { readFileSync } from 'node:fs'
|
|
|
|
|
import test from 'node:test'
|
|
|
|
|
|
2026-08-14 10:09:46 +08:00
|
|
|
import { normalizeModuleOrder, parseArguments } from '../admin-test-env-acceptance.mjs'
|
2026-08-13 16:58:17 +08:00
|
|
|
import { cleanupSucceeded, isAcceptanceFeeItem } from './fee-items.mjs'
|
2026-08-11 20:02:04 +08:00
|
|
|
|
|
|
|
|
const source = readFileSync(new URL('./fee-items.mjs', import.meta.url), 'utf8')
|
|
|
|
|
|
2026-08-19 09:42:07 +08:00
|
|
|
test('fee detail binding does not send the removed settlement switch', () => {
|
|
|
|
|
assert.match(source, /const detailPayload = \{/)
|
|
|
|
|
assert.doesNotMatch(source, /settlementIncluded/)
|
2026-08-11 20:02:04 +08:00
|
|
|
})
|
|
|
|
|
|
|
|
|
|
test('referenced fee-item deletion remains a conflict assertion', () => {
|
|
|
|
|
assert.match(source, /'任意客户费用明细引用后公共项目不可删除'[\s\S]*conflict\(protectedDeleteResponse\)/)
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
test('cleanup treats successful deletion and an already absent resource as clean', () => {
|
|
|
|
|
assert.equal(cleanupSucceeded({ http: 200, body: { code: '200' } }), true)
|
|
|
|
|
assert.equal(cleanupSucceeded({ http: 200, body: { code: 'A0404' } }), true)
|
|
|
|
|
assert.equal(cleanupSucceeded({ http: 404, body: {} }), true)
|
|
|
|
|
assert.equal(cleanupSucceeded({ http: 200, body: { code: 'A0422' } }), false)
|
|
|
|
|
})
|
2026-08-13 16:58:17 +08:00
|
|
|
|
|
|
|
|
test('stale cleanup only recognizes the acceptance-owned code and name pair', () => {
|
|
|
|
|
assert.equal(isAcceptanceFeeItem({ feeCode: 'ACPT_813083345572', feeTypeName: '全量验收费用-813083345572-已编辑' }), true)
|
|
|
|
|
assert.equal(isAcceptanceFeeItem({ feeCode: 'FEE_TYPE_001', feeTypeName: '全量验收费用-001' }), false)
|
|
|
|
|
assert.equal(isAcceptanceFeeItem({ feeCode: 'ACPT_813083345572', feeTypeName: '正式费用项目' }), false)
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
test('baseline checks run only after stale acceptance cleanup', () => {
|
|
|
|
|
assert.ok(source.indexOf('cleanupStaleAcceptanceItems(context)')
|
2026-09-08 21:05:15 +08:00
|
|
|
< source.indexOf("'正式目录112条且默认20条对应6页'"))
|
2026-08-14 10:09:46 +08:00
|
|
|
})
|
|
|
|
|
|
2026-09-08 21:05:15 +08:00
|
|
|
test('formal baseline includes both system fee items in addition to the 110 controlled items', () => {
|
|
|
|
|
assert.match(source, /const BASELINE_COUNT = 112/)
|
|
|
|
|
assert.match(source, /const INTERNATIONAL_COUNT = 28/)
|
2026-08-14 10:09:46 +08:00
|
|
|
assert.match(source, /'FBA_HEAD_FREIGHT'/)
|
2026-09-08 21:05:15 +08:00
|
|
|
assert.match(source, /'PRIVATE_LAST_MILE_DELIVERY'/)
|
2026-08-14 10:09:46 +08:00
|
|
|
})
|
|
|
|
|
|
|
|
|
|
test('fee-items injects its same-marker merchant and order fixtures for focused execution', () => {
|
|
|
|
|
const expected = ['merchant-qualification-fixture', 'orders', 'fee-items']
|
|
|
|
|
assert.deepEqual(normalizeModuleOrder(['fee-items']), expected)
|
|
|
|
|
assert.deepEqual(normalizeModuleOrder(['fee-items', 'orders']), expected)
|
|
|
|
|
assert.deepEqual(parseArguments(['--modules', 'fee-items']).modules, expected)
|
2026-08-13 16:58:17 +08:00
|
|
|
})
|