# changed city and state field mandatory for Survey questions.

This commit is contained in:
Amey Bhagwat 2026-11-20 18:05:01 +05:30
parent 351e8a7203
commit 51f99134c3
3 changed files with 19 additions and 4 deletions

View File

@ -136,13 +136,13 @@ export const surveyDefinition = {
{ id: 'other', label: 'Other (specify)' }, { id: 'other', label: 'Other (specify)' },
], ],
}, },
{ id: 'city', type: 'short_text', label: 'City', required: false }, { id: 'city', type: 'short_text', label: 'City', required: true },
{ {
id: 'state', id: 'state',
type: 'single_choice', type: 'single_choice',
display: 'dropdown', display: 'dropdown',
label: 'State', label: 'State',
required: false, required: true,
options: stateOptions, options: stateOptions,
}, },
], ],

View File

@ -83,6 +83,21 @@ function sample(question) {
} }
describe('survey answers', () => { describe('survey answers', () => {
it('requires city and state on the live demographics section', () => {
const demographics = {
sections: [surveyDefinition.sections.find((section) => section.id === 'demographics')],
};
const messages = validateAnswers(demographics, {}).map((item) => item.message);
expect(messages).toContain('City is required');
expect(messages).toContain('State is required');
expect(
validateAnswers(demographics, {
city: 'Pune',
state: { choice: 'maharashtra' },
}).map((item) => item.message),
).not.toEqual(expect.arrayContaining(['City is required', 'State is required']));
});
it('validates each question type', () => { it('validates each question type', () => {
expect( expect(
validateAnswers( validateAnswers(

View File

@ -13,8 +13,8 @@
- **Years of Practice:** ______ - **Years of Practice:** ______
- **Practice setting** (multi-select): Private Clinic / Private Hospital / Govt. Hospital / Other (please specify): ______ - **Practice setting** (multi-select): Private Clinic / Private Hospital / Govt. Hospital / Other (please specify): ______
- **Specialization** (single choice): Chest Physician / Consulting Physician / Other (specify): ______ - **Specialization** (single choice): Chest Physician / Consulting Physician / Other (specify): ______
- **City:** ______ - **City:** ______ (required)
- **State** (dropdown): all Indian states and union territories - **State** (dropdown, required): all Indian states and union territories
## Section 2: Physician Practice Profile ## Section 2: Physician Practice Profile