Add JSON files for security audit and test data

- Created a JSON file for the security audit report dated 2026-07-19, detailing various security findings and their relationships.
- Added a JSON file for seed test data, including user creation logic and dependencies in the `seed_testdata.php` file.
- Introduced a JSON file for the AdminCspSubscriberTest, outlining test cases and their structure in the `AdminCspSubscriberTest.php`.
This commit is contained in:
hamed
2026-07-23 15:12:37 +03:30
parent 9a776be13c
commit 0edaf6518f
17 changed files with 2085 additions and 1687 deletions
@@ -95,6 +95,50 @@ describe('NewAppointmentModal — جستجوی موبایل‌محور', () => {
});
});
describe('NewAppointmentModal — جستجو با کد ملی', () => {
it('searches by national_code and books the found patient with its mobile', async () => {
get.mockResolvedValue({ success: true, data: { found: true, name: 'رضا کریمی', mobile: '09121112233', national_code: '0012345678' } });
renderWithProviders(<NewAppointmentModal slot={slot} onClose={() => {}} onSuccess={() => {}} />);
// تغییر معیار جستجو به کد ملی
fireEvent.click(screen.getByRole('button', { name: 'کد ملی' }));
fireEvent.change(screen.getByPlaceholderText('کد ملی ۱۰ رقمی'), { target: { value: '0012345678' } });
fireEvent.click(screen.getByRole('button', { name: 'جستجو' }));
await waitFor(() => expect(get).toHaveBeenCalledWith('/api/v1/my/appointment/patient-lookup?national_code=0012345678'));
await screen.findByText('بیمار یافت شد');
fireEvent.click(screen.getByRole('button', { name: 'ثبت نوبت' }));
await waitFor(() => expect(post).toHaveBeenCalledWith('/api/v1/my/appointment', expect.objectContaining({
patient_mobile: '09121112233',
patient_name: 'رضا کریمی',
patient_national_code: '0012345678',
})));
});
it('unknown national code reveals mobile + name fields and books the new patient', async () => {
get.mockResolvedValue({ success: true, data: { found: false } });
renderWithProviders(<NewAppointmentModal slot={slot} onClose={() => {}} onSuccess={() => {}} />);
fireEvent.click(screen.getByRole('button', { name: 'کد ملی' }));
fireEvent.change(screen.getByPlaceholderText('کد ملی ۱۰ رقمی'), { target: { value: '1234567891' } });
fireEvent.click(screen.getByRole('button', { name: 'جستجو' }));
// موبایل خواسته می‌شود؛ کد ملی فقط همان ورودیِ جستجو است (بدون فیلد تکراری)
const mob = await screen.findByPlaceholderText('مثال: 09123456789');
expect(screen.getAllByPlaceholderText('کد ملی ۱۰ رقمی')).toHaveLength(1);
fireEvent.change(screen.getByPlaceholderText('مثال: علی محمدی'), { target: { value: 'مریم خلیلی' } });
fireEvent.change(mob, { target: { value: '09990001122' } });
fireEvent.click(screen.getByRole('button', { name: 'ثبت نوبت' }));
await waitFor(() => expect(post).toHaveBeenCalledWith('/api/v1/my/appointment', expect.objectContaining({
patient_mobile: '09990001122',
patient_name: 'مریم خلیلی',
patient_national_code: '1234567891',
})));
});
});
describe('NewAppointmentModal — هزینه ویزیت', () => {
/** تعرفه را برای همان پزشکِ اسلات برمی‌گرداند؛ بقیهٔ GETها بیمارِ ناشناس. */
function mockPricing(rials: number, requireVisit = false) {