补齐海外仓和私人地址正常及短少收货真实验收
This commit is contained in:
@@ -236,7 +236,8 @@ function measurementReplayContext(approved = false, mutate = () => {}, submitCod
|
||||
}
|
||||
assert.match(requestPath, /\/measurements\/approve\?/)
|
||||
return { http: 200, body: { code: '200', data: {
|
||||
initialPricingSucceeded: true, initialFee: structuredClone(state.fee),
|
||||
initialPricingSucceeded: state.fee != null, feeStatus: state.fee ? 'CALCULATED' : 'UNPRICED',
|
||||
initialFee: structuredClone(state.fee),
|
||||
} }, requestId: 'approve-repeat', traceId: 'trace-approve' }
|
||||
}
|
||||
let data
|
||||
@@ -245,7 +246,10 @@ function measurementReplayContext(approved = false, mutate = () => {}, submitCod
|
||||
else if (requestPath.includes('/measurement-review-history?')) data = {
|
||||
records: state.reviews, total: state.reviews.length, page: 1, size: 200,
|
||||
}
|
||||
else if (requestPath.includes('/fees/latest?')) data = state.fee
|
||||
else if (requestPath.includes('/fees/latest?')) {
|
||||
if (state.fee == null) return { http: 200, body: { code: 'A0404' } }
|
||||
data = state.fee
|
||||
}
|
||||
else if (requestPath.includes('/fee-details?')) {
|
||||
assert.equal(new URL(requestPath, 'https://example.invalid').searchParams.get('includeHistory'), 'true')
|
||||
data = state.details
|
||||
@@ -308,6 +312,28 @@ test('approval replay uses the original key and old expectedVersion and compares
|
||||
assert.equal(JSON.stringify(evidence).includes(fixture.context.token), false)
|
||||
})
|
||||
|
||||
test('approval replay preserves an explicit unpriced result without creating fee facts', async () => {
|
||||
const fixture = measurementReplayContext(true)
|
||||
fixture.state.fee = null
|
||||
fixture.state.details = []
|
||||
const evidence = await verifyMeasurementApprovalReplay(fixture.context, fixture.input,
|
||||
{ measurementId: fixture.input.measurementId, expectedVersion: 3, reason: null }, 'unpriced-review-key')
|
||||
assert.equal(evidence.unchanged, true)
|
||||
assert.equal(evidence.feeId, '')
|
||||
assert.equal(evidence.feeVersion, null)
|
||||
assert.deepEqual(evidence.feeDetailIds, [])
|
||||
})
|
||||
|
||||
test('approval replay rejects newly created fee facts after an unpriced approval', async () => {
|
||||
const fixture = measurementReplayContext(true, state => {
|
||||
state.fee = { feeId: '9007199254740993191', feeVersion: 1 }
|
||||
})
|
||||
fixture.state.fee = null
|
||||
fixture.state.details = []
|
||||
await assert.rejects(verifyMeasurementApprovalReplay(fixture.context, fixture.input,
|
||||
{ measurementId: fixture.input.measurementId, expectedVersion: 3, reason: null }, 'unpriced-review-key'), /零新增/)
|
||||
})
|
||||
|
||||
for (const [name, mutate] of [
|
||||
['different fee ID', state => { state.fee.feeId = '9007199254740993191' }],
|
||||
['extra fee version', state => { state.fee.feeVersion += 1 }],
|
||||
@@ -320,7 +346,7 @@ for (const [name, mutate] of [
|
||||
const fixture = measurementReplayContext(true, mutate)
|
||||
await assert.rejects(verifyMeasurementApprovalReplay(fixture.context, fixture.input,
|
||||
{ measurementId: fixture.input.measurementId, expectedVersion: 3, reason: null }, 'original-review-key'),
|
||||
/零新增|唯一审核及已生成初算费用事实有效/)
|
||||
/零新增|唯一审核及初算状态事实有效/)
|
||||
})
|
||||
}
|
||||
|
||||
@@ -329,7 +355,7 @@ test('review history uses the real reviewResult field and rejects a fabricated r
|
||||
fixture.state.reviews[0] = { id: '9007199254740993109', measurementId: fixture.input.measurementId, result: 'APPROVED' }
|
||||
await assert.rejects(verifyMeasurementApprovalReplay(fixture.context, fixture.input,
|
||||
{ measurementId: fixture.input.measurementId, expectedVersion: 3, reason: null }, 'original-review-key'),
|
||||
/唯一审核及已生成初算费用事实有效/)
|
||||
/唯一审核及初算状态事实有效/)
|
||||
assert.equal(fixture.calls.some(call => call.method === 'POST'), false)
|
||||
assert.match(source, /item\.reviewResult === 'APPROVED'/)
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user