Skip to content

Improve PhishingController tests #916

New issue

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

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

Already on GitHub? # to your account

Merged
merged 2 commits into from
Sep 21, 2022
Merged

Conversation

Gudahtt
Copy link
Member

@Gudahtt Gudahtt commented Sep 20, 2022

The PhishingController tests now use fetch mocks for all tests that use fetch. nock is used to disable any network unmocked network requests. This should make the test suite more reliable, as it won't be affected by intermittent network failures anymore. To some degree it makes the tests more readable as well by making it more clear what is happening, at the cost of making them more verbose.

A few other minor improvements have been made as well, such as removing redundant tests and removing unnecessary generic type parameters. An unnecessary cast has been removed from the PhishingController as well.

I was tempted to make many further improvements to the tests beyond here, to make them easier to read, more in-line with our conventions, and more comprehensive. But I stopped here so that the diff for this PR would still be easily readable. Further improvements can be made later.

@Gudahtt Gudahtt force-pushed the improve-phishing-controller-tests branch from a9def4d to 0645c07 Compare September 20, 2022 23:53
@Gudahtt Gudahtt marked this pull request as ready for review September 20, 2022 23:59
@Gudahtt Gudahtt requested a review from a team as a code owner September 20, 2022 23:59
@Gudahtt Gudahtt force-pushed the improve-phishing-controller-tests branch from 0645c07 to ad36df5 Compare September 21, 2022 00:00
The PhishingController tests now use fetch mocks for all tests that
use fetch. `nock` is used to disable any network unmocked network
requests. This should make the test suite more reliable, as it won't be
affected by intermittent network failures anymore. To some degree it
makes the tests more readable as well by making it more clear what is
happening, at the cost of making them more verbose.

A few other minor improvements have been made as well, such as removing
redundant tests and removing unnecessary generic type parameters. An
unnecessary cast has been removed from the PhishingController as well.

I was tempted to make many further improvements to the tests beyond
here, to make them easier to read, more in-line with our conventions,
and more comprehensive. But I stopped here so that the diff for this PR
would still be easily readable. Further improvements can be made later.
@Gudahtt Gudahtt force-pushed the improve-phishing-controller-tests branch from ad36df5 to eaeace3 Compare September 21, 2022 00:02
Copy link
Member

@FrederikBolding FrederikBolding left a comment

Choose a reason for hiding this comment

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

LGTM - one small question though

@Gudahtt Gudahtt merged commit 680794f into main Sep 21, 2022
@Gudahtt Gudahtt deleted the improve-phishing-controller-tests branch September 21, 2022 12:22
MajorLift pushed a commit that referenced this pull request Oct 11, 2023
The PhishingController tests now use fetch mocks for all tests that
use fetch. `nock` is used to disable any network unmocked network
requests. This should make the test suite more reliable, as it won't be
affected by intermittent network failures anymore. To some degree it
makes the tests more readable as well by making it more clear what is
happening, at the cost of making them more verbose.

A few other minor improvements have been made as well, such as removing
redundant tests and removing unnecessary generic type parameters. An
unnecessary cast has been removed from the PhishingController as well.

I was tempted to make many further improvements to the tests beyond
here, to make them easier to read, more in-line with our conventions,
and more comprehensive. But I stopped here so that the diff for this PR
would still be easily readable. Further improvements can be made later.
MajorLift pushed a commit that referenced this pull request Oct 11, 2023
The PhishingController tests now use fetch mocks for all tests that
use fetch. `nock` is used to disable any network unmocked network
requests. This should make the test suite more reliable, as it won't be
affected by intermittent network failures anymore. To some degree it
makes the tests more readable as well by making it more clear what is
happening, at the cost of making them more verbose.

A few other minor improvements have been made as well, such as removing
redundant tests and removing unnecessary generic type parameters. An
unnecessary cast has been removed from the PhishingController as well.

I was tempted to make many further improvements to the tests beyond
here, to make them easier to read, more in-line with our conventions,
and more comprehensive. But I stopped here so that the diff for this PR
would still be easily readable. Further improvements can be made later.
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants