Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: added country disabling feature #1084

Merged
merged 4 commits into from
Sep 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions src/profile/ProfilePage.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,29 @@ describe('<ProfilePage />', () => {

expect(container.querySelector('.alert-danger')).toHaveClass('show');
});

it.each([
['test user with non-disabled country', 'PK'],
['test user with disabled country', 'RU'],
])('test user with %s', (_, accountCountry) => {
const storeData = JSON.parse(JSON.stringify(storeMocks.savingEditedBio));
storeData.profilePage.errors.country = {};
awais-ansari marked this conversation as resolved.
Show resolved Hide resolved
storeData.profilePage.currentlyEditingField = 'country';
storeData.profilePage.disabledCountries = ['RU'];
storeData.profilePage.account.country = accountCountry;
const contextValue = {
authenticatedUser: { userId: 123, username: 'staff', administrator: true },
config: getConfig(),
};
const component = (
<ProfilePageWrapper
contextValue={contextValue}
store={mockStore(storeData)}
/>
);
const { container: tree } = render(component);
expect(tree).toMatchSnapshot();
});
});

describe('handles analytics', () => {
Expand Down
3 changes: 2 additions & 1 deletion src/profile/__mocks__/savingEditedBio.mockStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,8 @@ module.exports = {
}
],
drafts: {},
isLoadingProfile: false
isLoadingProfile: false,
disabledCountries: [],
},
router: {
location: {
Expand Down
Loading