41 lines
1.8 KiB
TypeScript
Executable File
41 lines
1.8 KiB
TypeScript
Executable File
import { describe, it, expect } from 'cypress'
|
|
|
|
describe('HIS System Regression Tests', () => {
|
|
// ... existing tests ...
|
|
|
|
describe('Bug #506: 门诊诊前退号状态值修复', { tags: ['@bug506', '@regression'] }, () => {
|
|
it('should correctly update order_main, schedule_slot, schedule_pool and refund_log after cancellation', () => {
|
|
const testOrderId = 1001
|
|
const testSlotId = 2001
|
|
const testPoolId = 3001
|
|
|
|
// 模拟调用退号接口
|
|
cy.request({
|
|
method: 'POST',
|
|
url: '/api/outpatient/registration/cancel',
|
|
body: { orderId: testOrderId, reason: '诊前退号' }
|
|
}).then((response) => {
|
|
expect(response.status).to.eq(200)
|
|
expect(response.body.code).to.eq(200)
|
|
|
|
// 验证 order_main 状态
|
|
expect(response.body.data.orderMain.status).to.eq(0, 'order_main.status 应为 0(已取消)')
|
|
expect(response.body.data.orderMain.payStatus).to.eq(3, 'order_main.pay_status 应为 3(已退费)')
|
|
expect(response.body.data.orderMain.cancelReason).to.eq('诊前退号', 'cancel_reason 应为 诊前退号')
|
|
expect(response.body.data.orderMain.cancelTime).to.not.be.null, 'cancel_time 应写入当前时间'
|
|
|
|
// 验证 adm_schedule_slot 状态
|
|
expect(response.body.data.slot.status).to.eq(0, 'slot.status 应为 0(待约)')
|
|
expect(response.body.data.slot.orderId).to.be.null, 'slot.order_id 应回滚为 NULL'
|
|
|
|
// 验证 adm_schedule_pool 状态
|
|
expect(response.body.data.pool.versionChange).to.eq(1, 'pool.version 应累加 1')
|
|
expect(response.body.data.pool.bookedNumChange).to.eq(-1, 'pool.booked_num 应减 1')
|
|
|
|
// 验证 refund_log 关联
|
|
expect(response.body.data.refundLog.orderId).to.eq(testOrderId, 'refund_log.order_id 应关联 order_main.id')
|
|
})
|
|
})
|
|
})
|
|
})
|