Add a doctor/clinic settings sub-navigation shell (SettingsLayout) with "خرید اشتراک" as its first section, plus a mobile settings-list page. Rebuild the plan-selection page with a per-plan billing-period toggle, single price, most-popular badge and a current-plan status banner. Add a payment-success page that reads the gateway return params (?payment_uuid&status), shows the transaction receipt and the newly active plan, and redirects to the plans page with a toast on any non-success status. Frontend only — reuses the existing /api/v1/subscription/* and /api/v1/subscription-payment endpoints; no backend or API-doc changes. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
23 lines
924 B
TypeScript
23 lines
924 B
TypeScript
import { describe, it, expect } from 'vitest';
|
|
import { screen } from '@testing-library/react';
|
|
import { renderWithProviders } from '../test/utils';
|
|
import SettingsMenuPage from './SettingsMenuPage';
|
|
import { SETTINGS_MENU } from '../components/layout/SettingsLayout';
|
|
|
|
describe('SettingsMenuPage', () => {
|
|
it('lists every settings section', () => {
|
|
renderWithProviders(<SettingsMenuPage />);
|
|
for (const item of SETTINGS_MENU) {
|
|
expect(screen.getByText(item.label)).toBeInTheDocument();
|
|
}
|
|
});
|
|
|
|
it('links implemented sections and disables the rest', () => {
|
|
renderWithProviders(<SettingsMenuPage />);
|
|
// implemented → anchor with href
|
|
expect(screen.getByText('خرید اشتراک').closest('a')).toHaveAttribute('href', '/admin/subscription');
|
|
// not implemented → disabled button
|
|
expect(screen.getByText('مدیریت پزشک').closest('button')).toBeDisabled();
|
|
});
|
|
});
|