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

Added PollingControllerOnly #1873

Merged
merged 6 commits into from
Oct 20, 2023
Merged

Added PollingControllerOnly #1873

merged 6 commits into from
Oct 20, 2023

Conversation

shanejonas
Copy link
Contributor

@shanejonas shanejonas commented Oct 19, 2023

Explanation

Added PollingControllerOnly to extend from an empty class. This will allow classes that previously are just classes that don't extend from BaseV2 or V2 to extend from this new PollingControllerOnly.

Changelog

@metamask/polling-controller

  • ADDED: PollingControllerOnly to extend from an empty class

@shanejonas shanejonas requested a review from a team as a code owner October 19, 2023 19:26
adonesky1
adonesky1 previously approved these changes Oct 19, 2023
Copy link
Contributor

@adonesky1 adonesky1 left a comment

Choose a reason for hiding this comment

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

LGTM!

_executePoll = createExecutePollMock();
}
const c = new MyClass();
expect(c).toBeDefined();
Copy link
Contributor

@mcmire mcmire Oct 19, 2023

Choose a reason for hiding this comment

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

Hmm. It seems like you could have written this test without extending from anything and it would have still passed.

Why is a class that extends from PollingControllerBase any different from a class that extends from PollingController or PollingControllerV1? Can we copy over the existing tests that we have? It seems like we'd still want to verify that such a class that extends from PollingControllerBase can be used to poll in all the ways it's supposed to.

Copy link
Contributor Author

@shanejonas shanejonas Oct 20, 2023

Choose a reason for hiding this comment

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

I'm not really looking to test that the functionality works again, but that my PollingControllerMixin(Empty) line works properly, that it can extend this empty class and still have all the methods.

I updated the test to check all the methods exist.

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not really looking to test that the functionality works again,

Sorry, I don't understand this decision. This interface is just as valid as the other interfaces you have here, and therefore the functionality it has is just as important to test, in exactly the same way. It seems to me that you think that this class ought to work because it's based on the same class as the other two classes. It's true they all share the same implementation, but that implementation is completely private to consumers.

Copy link
Contributor

Choose a reason for hiding this comment

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

@shanejonas ☝️

packages/polling-controller/src/PollingController.ts Outdated Show resolved Hide resolved
adonesky1
adonesky1 previously approved these changes Oct 20, 2023
jiexi
jiexi previously approved these changes Oct 20, 2023
@shanejonas shanejonas changed the title Added PollingControllerBase Added PollingControllerOnly Oct 20, 2023
@shanejonas shanejonas dismissed stale reviews from jiexi and adonesky1 via 045c774 October 20, 2023 16:39
@adonesky1 adonesky1 merged commit 4b3098c into main Oct 20, 2023
111 checks passed
@adonesky1 adonesky1 deleted the polling-controller-base branch October 20, 2023 18:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants