test(finance): sync formal fee item baseline
This commit is contained in:
@@ -31,13 +31,14 @@ test('stale cleanup only recognizes the acceptance-owned code and name pair', ()
|
||||
|
||||
test('baseline checks run only after stale acceptance cleanup', () => {
|
||||
assert.ok(source.indexOf('cleanupStaleAcceptanceItems(context)')
|
||||
< source.indexOf("'正式目录111条且默认20条对应6页'"))
|
||||
< source.indexOf("'正式目录112条且默认20条对应6页'"))
|
||||
})
|
||||
|
||||
test('formal baseline includes the system FBA freight item in addition to the 110 controlled items', () => {
|
||||
assert.match(source, /const BASELINE_COUNT = 111/)
|
||||
assert.match(source, /const INTERNATIONAL_COUNT = 27/)
|
||||
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/)
|
||||
assert.match(source, /'FBA_HEAD_FREIGHT'/)
|
||||
assert.match(source, /'PRIVATE_LAST_MILE_DELIVERY'/)
|
||||
})
|
||||
|
||||
test('fee-items injects its same-marker merchant and order fixtures for focused execution', () => {
|
||||
|
||||
@@ -2,9 +2,9 @@ const MODULE = 'fee-items'
|
||||
const SCENARIO = 'platform-public-fee-items'
|
||||
const OPTIONS = { scenario: SCENARIO, deploymentBlocker: true }
|
||||
const BASE = '/api/platform/v1/fee-items'
|
||||
const BASELINE_COUNT = 111
|
||||
const BASELINE_COUNT = 112
|
||||
const DOMESTIC_COUNT = 84
|
||||
const INTERNATIONAL_COUNT = 27
|
||||
const INTERNATIONAL_COUNT = 28
|
||||
const MERCHANT_USERNAME = process.env.MERCHANT_TEST_USERNAME || ''
|
||||
const MERCHANT_PASSWORD = process.env.MERCHANT_TEST_PASSWORD || ''
|
||||
|
||||
@@ -47,6 +47,7 @@ function payload(suffix, overrides = {}) {
|
||||
function expectedCodes() {
|
||||
return [
|
||||
'FBA_HEAD_FREIGHT',
|
||||
'PRIVATE_LAST_MILE_DELIVERY',
|
||||
...Array.from({ length: 110 }, (_, index) => `FEE_TYPE_${String(index + 1).padStart(3, '0')}`),
|
||||
].sort()
|
||||
}
|
||||
@@ -90,7 +91,7 @@ export async function run(context) {
|
||||
const initialPageResponse = await context.request('GET', query({ page: 1, size: 20 }))
|
||||
const initialPage = context.apiSuccess(MODULE, '费用项目查看权限与分页查询', initialPageResponse,
|
||||
'page=1,size=20', OPTIONS)
|
||||
context.assert(MODULE, '正式目录111条且默认20条对应6页', initialPageResponse,
|
||||
context.assert(MODULE, '正式目录112条且默认20条对应6页', initialPageResponse,
|
||||
records(initialPage).length === 20 && Number(initialPage?.total) === BASELINE_COUNT
|
||||
&& Number(initialPage?.pages) === 6 && Number(initialPage?.page) === 1,
|
||||
`records=${records(initialPage).length}, total=${initialPage?.total ?? 'n/a'}, pages=${initialPage?.pages ?? 'n/a'}`, OPTIONS)
|
||||
@@ -103,13 +104,13 @@ export async function run(context) {
|
||||
const domestic = initialRows.filter((row) => row.tradeScope === 'DOMESTIC')
|
||||
const international = initialRows.filter((row) => row.tradeScope === 'INTERNATIONAL')
|
||||
const actualCodes = initialRows.map((row) => row.feeCode).sort()
|
||||
context.assert(MODULE, '正式目录111条全部属于平台且状态ACTIVE', initial.response,
|
||||
context.assert(MODULE, '正式目录112条全部属于平台且状态ACTIVE', initial.response,
|
||||
initialRows.length === BASELINE_COUNT && initialRows.every((row) => id(row.tenantId) === '0' && row.status === 'ACTIVE'),
|
||||
`rows=${initialRows.length}, platform=${initialRows.filter((row) => id(row.tenantId) === '0').length}, active=${initialRows.filter((row) => row.status === 'ACTIVE').length}`, OPTIONS)
|
||||
context.assert(MODULE, '国内84条、国际27条范围正确', initial.response,
|
||||
context.assert(MODULE, '国内84条、国际28条范围正确', initial.response,
|
||||
domestic.length === DOMESTIC_COUNT && international.length === INTERNATIONAL_COUNT,
|
||||
`DOMESTIC=${domestic.length}, INTERNATIONAL=${international.length}`, OPTIONS)
|
||||
context.assert(MODULE, '正式编码完整覆盖110条受控项目及系统头程运费', initial.response,
|
||||
context.assert(MODULE, '正式编码完整覆盖110条受控项目及两条系统费用', initial.response,
|
||||
actualCodes.join(',') === expectedCodes().join(','),
|
||||
`codes=${actualCodes.length}, first=${actualCodes[0] || 'missing'}, last=${actualCodes.at(-1) || 'missing'}`, OPTIONS)
|
||||
|
||||
@@ -141,7 +142,7 @@ export async function run(context) {
|
||||
|
||||
const activeResponse = await context.request('GET', query({ status: 'ACTIVE', page: 1, size: 200 }))
|
||||
const activePage = context.apiSuccess(MODULE, '按 ACTIVE 状态筛选费用项目', activeResponse, '', OPTIONS)
|
||||
context.assert(MODULE, 'ACTIVE 筛选返回111条且无停用记录', activeResponse,
|
||||
context.assert(MODULE, 'ACTIVE 筛选返回112条且无停用记录', activeResponse,
|
||||
Number(activePage?.total) === BASELINE_COUNT && records(activePage).every((row) => row.status === 'ACTIVE'),
|
||||
`total=${activePage?.total ?? 'n/a'}`, OPTIONS)
|
||||
|
||||
@@ -272,7 +273,7 @@ export async function run(context) {
|
||||
`feeItemId=${feeItemId}`, OPTIONS)
|
||||
}
|
||||
const final = await listAll(context)
|
||||
context.assert(MODULE, '清理后恢复111条正式基线且无临时编码或名称', final.response,
|
||||
context.assert(MODULE, '清理后恢复112条正式基线且无临时编码或名称', final.response,
|
||||
final.rows.length === BASELINE_COUNT && !final.rows.some((row) => row.feeCode === createPayload.feeCode
|
||||
|| String(row.feeTypeName).includes(suffix)),
|
||||
`rows=${final.rows.length}, temporary=${final.rows.filter((row) => row.feeCode === createPayload.feeCode).length}`, OPTIONS)
|
||||
|
||||
Reference in New Issue
Block a user