-
Notifications
You must be signed in to change notification settings - Fork 3
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
1945: Unit test card search params #1947
base: 1799-card-generator-refactoring
Are you sure you want to change the base?
1945: Unit test card search params #1947
Conversation
affc752
to
aea1fc0
Compare
administration/src/bp-modules/cards/hooks/useCardGenerator.test.tsx
Outdated
Show resolved
Hide resolved
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.
Nice, I like it 👍 You want to add the same tests for useSelfServiceCardGenerator
? Also, there is no test yet for initializing applicationIdToMarkAsProcessed
if you feel motivated.
administration/src/bp-modules/cards/hooks/useCardGenerator.test.tsx
Outdated
Show resolved
Hide resolved
administration/src/bp-modules/cards/hooks/useCardGenerator.test.tsx
Outdated
Show resolved
Hide resolved
administration/src/bp-modules/cards/hooks/useCardGenerator.test.tsx
Outdated
Show resolved
Hide resolved
I moved the test for koblenz to the selfService hook. Not sure if we need both tests, since normal card creation is disabled for koblenz. I dunno how i should test this applicationId since it will not be set in the cards object. |
12ef720
to
9b1ff72
Compare
const wrapper = ({ children, initialRoutes }: { children: ReactNode; initialRoutes?: string[] }) => ( | ||
<MemoryRouter initialEntries={initialRoutes}> | ||
<AppToasterProvider> | ||
<MockedProvider mocks={mocks} addTypename={false}> | ||
<ProjectConfigProvider projectConfig={koblenzConfig}>{children}</ProjectConfigProvider> | ||
</MockedProvider> | ||
</AppToasterProvider> | ||
</MemoryRouter> | ||
) | ||
|
||
const withCustomWrapper = | ||
(initialRoute: string) => | ||
({ children }: { children: ReactNode }) => | ||
wrapper({ | ||
children, | ||
initialRoutes: [initialRoute], | ||
}) |
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.
🙃 I guess we should make this reusable at some point to a shared testing file.
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.
Yes feel free to add a task for this
You could mock the mutation and ensure that it was called with the application id from the query params. |
Short Description
Add unit tests for correctly initializing cards with searchParams.
Proposed Changes
Side Effects
Testing
N/A
Resolved Issues
Fixes: #1945