Files
baiyue-firstleg/scripts/admin-test-env-modules/fee-items-contract.test.mjs
T

23 lines
1022 B
JavaScript

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