更新
This commit is contained in:
@@ -1305,6 +1305,48 @@ test('both slips use verified physician and pharmacist PNGs and fall back to the
|
||||
assert.equal(reviewerName.value, '测试药师')
|
||||
})
|
||||
|
||||
test('only issued prescriptions without physician CA or a pharmacist signature display the sample', () => {
|
||||
const legacy = status({ status: 'legacy', required: false })
|
||||
const signed = status({ status: 'signed', can_download: true, review_required: true, review_state: 'pending' })
|
||||
const base = { audit_status: 1, void_status: 0, is_system_auto: 0, herbs: [{ name: '测试药材', dosage: 1 }], esign: legacy }
|
||||
const props = vue.reactive({ data: base, showPharmacistSignatureSample: true })
|
||||
const { getSlipHerbs } = loadModule('components/prescription-slip/utils.ts', {})
|
||||
const { showPharmacistSample } = pageDeclarations('components/prescription-slip/index.vue', ['showPharmacistSample'],
|
||||
{ computed: vue.computed, props, getSlipHerbs })
|
||||
|
||||
assert.equal(showPharmacistSample.value, true)
|
||||
props.showPharmacistSignatureSample = false
|
||||
assert.equal(showPharmacistSample.value, false)
|
||||
props.showPharmacistSignatureSample = true
|
||||
props.data = { ...base, audit_status: 0, esign: signed }
|
||||
assert.equal(showPharmacistSample.value, false)
|
||||
props.data = { ...base, audit_status: 0, doctor_signature: 'signature.png', review_submitted_at: 123 }
|
||||
assert.equal(showPharmacistSample.value, true)
|
||||
|
||||
for (const update of [
|
||||
{ audit_status: 0 }, { void_status: 1 }, { audit_status: 2 }, { herbs: [] }, { is_system_auto: 1 },
|
||||
{ esign: status({ awaiting_upload: true }) }, { esign: signed },
|
||||
{ esign: { ...signed, review_required: false, review_state: undefined } },
|
||||
{ esign: { ...legacy, required: true } }, { esign: { ...legacy, can_download: true } },
|
||||
{ esign: { ...legacy, review_state: 'signed' } }, { esign: { ...legacy, review_signature_time: 123 } },
|
||||
{ esign: { ...legacy, review_signer_name: '已签署药师' } }, { esign: { ...legacy, review_signature: 'seal' } }
|
||||
]) {
|
||||
props.data = { ...base, ...update }
|
||||
assert.equal(showPharmacistSample.value, false, JSON.stringify(update))
|
||||
}
|
||||
})
|
||||
|
||||
test('issued and order previews opt into the sample and the slip excludes it from exports', () => {
|
||||
const source = (file) => fs.readFileSync(path.join(__dirname, '../src', file), 'utf8')
|
||||
const paths = ['index.vue', 'order_list.vue', 'order_list_h5.vue']
|
||||
for (const filename of paths) {
|
||||
assert.match(source(`views/consumer/prescription/${filename}`), /<PrescriptionSlip[^>]+show-pharmacist-signature-sample/)
|
||||
}
|
||||
const slip = source('components/prescription-slip/index.vue')
|
||||
assert.match(slip, /rx-bot-doctor[\s\S]*v-else-if="showPharmacistSample"[^>]*data-html2canvas-ignore="true"[\s\S]*rx-bot-meta/)
|
||||
assert.match(slip, /@media print\s*\{\s*\.rx-pharmacist-sample\s*\{\s*display: none;/)
|
||||
})
|
||||
|
||||
test('the slip reloads a newly verified physician seal once from prescription detail', async () => {
|
||||
const requests = []
|
||||
const { updatePrescriptionSlipEsign } = loadModule('utils/prescription-esign.ts', { '@/api/tcm': {
|
||||
|
||||
Reference in New Issue
Block a user