-
Notifications
You must be signed in to change notification settings - Fork 73
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
chore: replace test router with memoryrouter, update partially tests #8102
Conversation
Oops! Looks like you forgot to update the changelog. When updating CHANGELOG.md, please consider the following:
|
vi.spyOn(profileSelectors, 'getScope').mockReturnValue(['register']) | ||
|
||
const form = await getReviewFormFromStore(store, EventType.Birth) | ||
|
||
const testComponent = await createTestComponent( | ||
// @ts-ignore | ||
// @TODO |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In a sense that test logic needs to be inspected
packages/client/src/tests/util.tsx
Outdated
const app = mount( | ||
<App store={store} history={history} client={createGraphQLClient()} /> | ||
<Root store={store} router={router} client={createGraphQLClient()} /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
History is no longert needed. Use Router to access location etc. in tests.
</Provider> | ||
) | ||
} | ||
|
||
return mount(<PropProxy {...node.props} />, options) | ||
return { component: mount(<PropProxy />, options), router } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Most of the tests will work once history is removed and we access component
property
staticContext={undefined} | ||
history={history} | ||
location={history.location} | ||
// match={{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These should not be needed, router will handle them
const testComponent = await createTestComponent( | ||
// @ts-ignore | ||
// @TODO | ||
const foo = formatUrl(REVIEW_EVENT_PARENT_FORM_PAGE_GROUP, { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Figure out which URL needs to be given here. I changed it group since it was given as part of match.
) | ||
|
||
const { status, node } = actionStatus(component, [ACTION.VIEW_DECLARATION]) | ||
expect(status).toBe(ACTION_STATUS.ENABLED) | ||
|
||
node?.simulate('click') | ||
|
||
expect(window.location.href).toContain( | ||
expect(router.state.location.pathname).toContain( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need to access window, use this pattern
…to router-testing
…to router-testing
…to router-testing
file is referenced by two casings and it creates issues with git
Seems that creation does not work as intented
initially changed due removal of router navigation from state
0f0bdad
into
chore/upgrade-react-router-dom
No description provided.