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

Fix AboutPage test console error output #1031

Merged
merged 1 commit into from
Dec 5, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions assets/js/components/AboutPage/AboutPage.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ describe('AboutPage component', () => {
it('should render the about page with default values if api get request fails', async () => {
const stateValues = { flavor: 'N/A', subscriptions: 0, version: 'v0.0.0' };
const errorMessage = { messages: "Get request '/api/about' failed" };
jest.spyOn(console, 'error').mockImplementation(() => null);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we can have an helper called silenceErrorMessages or something, but as I write this I have to say that I'm not a big fan of silencing error messages

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, in this is case is a known error, so it is fine i think

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@arbulu89 if I'm not wrong this is the second time we set a similar spy, do we wanna have an helper?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Personally I wouldn't. It is simply a one liner. But up to @EMaksy

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then we leave it this way. LGTM

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK fine by me, maybe when this problem reappears in the future we can discuss adding a helper!


await act(async () => {
renderWithRouter(
<AboutPage onFetch={() => Promise.reject(errorMessage)} />
Expand Down