feat(appointment): derive service section from service item when missing in appointment

This commit is contained in:
hamed
2026-08-08 07:14:40 +03:30
parent da07e3ad9c
commit b699476305
5 changed files with 144 additions and 22 deletions
@@ -50,6 +50,29 @@ describe('AppointmentEditPage (ویرایش نوبت)', () => {
expect(screen.getByDisplayValue('یادداشت')).toBeInTheDocument();
});
// بخش و سرویس هر دو باید برچسب واقعی نشان دهند، نه placeholder. فهرست سرویس‌ها
// از بخش می‌آید، پس بخشِ خالی یعنی سرویسِ ذخیره‌شده هم انتخاب‌نشده دیده می‌شود —
// همان باگی که در ۲۰۲۶-۰۸-۰۸ گزارش شد.
it('shows the stored section and service, not their placeholders', async () => {
renderEdit();
await screen.findByText('مشخصات سرویس:');
expect(await screen.findByText('زیبایی')).toBeInTheDocument();
expect(await screen.findByText('لیزر')).toBeInTheDocument();
expect(screen.queryByText('انتخاب بخش')).not.toBeInTheDocument();
expect(screen.queryByText('انتخاب سرویس')).not.toBeInTheDocument();
});
// بلوک بیعانه فعلاً از فرم برداشته شده، ولی مقدارش همچنان ذخیره می‌شود
// (اثباتش در تست بعدی: deposit_required در payload هست).
it('no longer renders the deposit block', async () => {
renderEdit();
await screen.findByText('مشخصات سرویس:');
expect(screen.queryByText('بیعانه:')).not.toBeInTheDocument();
expect(screen.queryByText('بیعانه مورد نیاز است.')).not.toBeInTheDocument();
});
it('patches the general update endpoint with the edited values', async () => {
renderEdit();
await screen.findByText('مشخصات سرویس:');