Skip to content

Commit

Permalink
Settings page - marital status translation updated, +test cases (#2124)
Browse files Browse the repository at this point in the history
  • Loading branch information
mahak-juriani authored Jul 27, 2024
1 parent 7f71db5 commit 5448735
Show file tree
Hide file tree
Showing 6 changed files with 144 additions and 5 deletions.
2 changes: 1 addition & 1 deletion public/locales/en/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -789,7 +789,7 @@
"widowed": "Widowed",
"divorced": "Divorced",
"engaged": "Engaged",
"seperated": "Seperated",
"separated": "Separated",
"grade1": "Grade 1",
"grade2": "Grade 2",
"grade3": "Grade 3",
Expand Down
2 changes: 1 addition & 1 deletion public/locales/fr/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -789,7 +789,7 @@
"widowed": "Veuf",
"divorced": "Divorcé",
"engaged": "Engagé",
"seperated": "Séparé",
"separated": "Séparé",
"grade1": "1re année",
"grade2": "2e année",
"grade3": "3e année",
Expand Down
2 changes: 1 addition & 1 deletion public/locales/hi/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -789,7 +789,7 @@
"widowed": "विधवा",
"divorced": "तलाकशुदा",
"engaged": "काम में लगा हुआ",
"seperated": "विभाजित",
"separated": "विभाजित",
"grade1": "ग्रेड 1",
"grade2": "ग्रेड 2",
"grade3": "ग्रेड 3",
Expand Down
2 changes: 1 addition & 1 deletion public/locales/sp/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -990,7 +990,7 @@
"divorced": "Divorciado",
"widowed": "Viudo",
"engaged": "Comprometido",
"seperated": "Separado",
"separated": "Separado",
"grade1": "1er Grado",
"grade2": "2do Grado",
"grade3": "3er Grado",
Expand Down
2 changes: 1 addition & 1 deletion public/locales/zh/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -789,7 +789,7 @@
"widowed": "",
"divorced": "离婚",
"engaged": "已订婚的",
"seperated": "分离的",
"separated": "分离的",
"grade1": "1级",
"grade2": "二年级",
"grade3": "三年级",
Expand Down
139 changes: 139 additions & 0 deletions src/screens/UserPortal/Settings/Settings.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,33 @@ const Mocks2 = [
},
];

const mockMaritalStatusEnum = [
{
value: 'SINGLE',
label: 'Single',
},
{
value: 'ENGAGED',
label: 'Engaged',
},
{
value: 'MARRIED',
label: 'Married',
},
{
value: 'DIVORCED',
label: 'Divorced',
},
{
value: 'WIDOWED',
label: 'Widowed',
},
{
value: 'SEPARATED',
label: 'Separated',
},
];

const link = new StaticMockLink(MOCKS, true);
const link1 = new StaticMockLink(Mocks1, true);
const link2 = new StaticMockLink(Mocks2, true);
Expand Down Expand Up @@ -367,4 +394,116 @@ describe('Testing Settings Screen [User Portal]', () => {
userEvent.click(screen.getByTestId('updateUserBtn'));
await wait();
});

test('Marital Status dropdown value verification', async () => {
render(
<MockedProvider addTypename={false} link={link}>
<BrowserRouter>
<Provider store={store}>
<I18nextProvider i18n={i18nForTest}>
<Settings />
</I18nextProvider>
</Provider>
</BrowserRouter>
</MockedProvider>,
);

await wait();

// SINGLE
expect(
screen.queryByRole('option', { name: mockMaritalStatusEnum[0].label }),
).toBeInTheDocument();

userEvent.selectOptions(
// Find the select element
screen.getByTestId('inputMaritalStatus'),
// Find and select the Single option
screen.getByRole('option', { name: mockMaritalStatusEnum[0].label }),
);

expect(screen.getByTestId('inputMaritalStatus')).toHaveValue(
mockMaritalStatusEnum[0].value,
);

// ENGAGED
expect(
screen.queryByRole('option', { name: mockMaritalStatusEnum[1].label }),
).toBeInTheDocument();

userEvent.selectOptions(
// Find the select element
screen.getByTestId('inputMaritalStatus'),
// Find and select the Engaged option
screen.getByRole('option', { name: mockMaritalStatusEnum[1].label }),
);

expect(screen.getByTestId('inputMaritalStatus')).toHaveValue(
mockMaritalStatusEnum[1].value,
);

// MARRIED
expect(
screen.queryByRole('option', { name: mockMaritalStatusEnum[2].label }),
).toBeInTheDocument();

userEvent.selectOptions(
// Find the select element
screen.getByTestId('inputMaritalStatus'),
// Find and select the Married option
screen.getByRole('option', { name: mockMaritalStatusEnum[2].label }),
);

expect(screen.getByTestId('inputMaritalStatus')).toHaveValue(
mockMaritalStatusEnum[2].value,
);

// DIVORCED
expect(
screen.queryByRole('option', { name: mockMaritalStatusEnum[3].label }),
).toBeInTheDocument();

userEvent.selectOptions(
// Find the select element
screen.getByTestId('inputMaritalStatus'),
// Find and select the Divorced option
screen.getByRole('option', { name: mockMaritalStatusEnum[3].label }),
);

expect(screen.getByTestId('inputMaritalStatus')).toHaveValue(
mockMaritalStatusEnum[3].value,
);

// WIDOWED
expect(
screen.queryByRole('option', { name: mockMaritalStatusEnum[4].label }),
).toBeInTheDocument();

userEvent.selectOptions(
// Find the select element
screen.getByTestId('inputMaritalStatus'),
// Find and select the Widowed option
screen.getByRole('option', { name: mockMaritalStatusEnum[4].label }),
);

expect(screen.getByTestId('inputMaritalStatus')).toHaveValue(
mockMaritalStatusEnum[4].value,
);

// SEPARATED
expect(
screen.queryByRole('option', { name: mockMaritalStatusEnum[5].label }),
).toBeInTheDocument();

userEvent.selectOptions(
// Find the select element
screen.getByTestId('inputMaritalStatus'),
// Find and select the Separated option
screen.getByRole('option', { name: mockMaritalStatusEnum[5].label }),
);

expect(screen.getByTestId('inputMaritalStatus')).toHaveValue(
mockMaritalStatusEnum[5].value,
);
}, 60000);
});

0 comments on commit 5448735

Please sign in to comment.