Skip to content

Commit

Permalink
feat: fixed tests
Browse files Browse the repository at this point in the history
  • Loading branch information
vladislavkeblysh committed Dec 29, 2023
1 parent fabef0d commit b368476
Show file tree
Hide file tree
Showing 2 changed files with 892 additions and 40 deletions.
13 changes: 6 additions & 7 deletions src/profile/ProfilePage.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const requiredProfilePageProps = {
deleteProfilePhoto: () => {},
openField: () => {},
closeField: () => {},
match: { params: { username: 'staff' } },
params: { username: 'staff' },
};

// Mock language cookie
Expand Down Expand Up @@ -67,29 +67,28 @@ beforeEach(() => {
});

const ProfilePageWrapper = ({
contextValue, store, match, requiresParentalConsent,
contextValue, store, params, requiresParentalConsent,
}) => (
<AppContext.Provider
value={contextValue}
>
<IntlProvider locale="en">
<Provider store={store}>
<ProfilePage {...requiredProfilePageProps} match={match} requiresParentalConsent={requiresParentalConsent} />
<ProfilePage {...requiredProfilePageProps} params={params} requiresParentalConsent={requiresParentalConsent} />
</Provider>
</IntlProvider>
</AppContext.Provider>
);

ProfilePageWrapper.defaultProps = {
match: { params: { username: 'staff' } },
params: { username: 'staff' },
requiresParentalConsent: null,

};

ProfilePageWrapper.propTypes = {
contextValue: PropTypes.shape({}).isRequired,
store: PropTypes.shape({}).isRequired,
match: PropTypes.shape({}),
params: PropTypes.shape({}),
requiresParentalConsent: PropTypes.bool,
};

Expand Down Expand Up @@ -297,7 +296,7 @@ describe('<ProfilePage />', () => {
<ProfilePageWrapper
contextValue={contextValue}
store={mockStore(storeMocks.loadingApp)}
match={{ params: { username: 'test-username' } }}
params={{ username: 'test-username' }}
/>
);
const wrapper = mount(component);
Expand Down
Loading

0 comments on commit b368476

Please sign in to comment.