test(admin): align fee item acceptance payload

This commit is contained in:
2026-08-11 20:02:04 +08:00
parent 48bb752007
commit 1f4b09f0c9
2 changed files with 31 additions and 3 deletions
@@ -0,0 +1,22 @@
import assert from 'node:assert/strict'
import { readFileSync } from 'node:fs'
import test from 'node:test'
import { cleanupSucceeded } from './fee-items.mjs'
const source = readFileSync(new URL('./fee-items.mjs', import.meta.url), 'utf8')
test('fee detail binding explicitly sends the settlement inclusion contract field', () => {
assert.match(source, /const detailPayload = \{[\s\S]*settlementIncluded: false/)
})
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)
})