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

Make SnapController.add() private #883

Merged
merged 4 commits into from Oct 31, 2022

Conversation

rekmarks
Copy link
Member

This PR turns SnapController.add() into a private method _add() and removes its associated action. Due to the extensive use of this method in tests, a new SnapController persisted state factory is added to our test utilities and used instead of add(). Overall unit tests coverage has decreased slightly due to the removal of tested code.

@rekmarks rekmarks requested a review from a team as a code owner October 28, 2022 17:37
@@ -1780,7 +1766,7 @@ export class SnapController extends BaseController<
* version.
* @returns The resulting snap object.
*/
async add(args: AddSnapArgs): Promise<PersistedSnap> {
private async _add(args: AddSnapArgs): Promise<PersistedSnap> {
Copy link
Member

Choose a reason for hiding this comment

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

Should we truly make it private?

Suggested change
private async _add(args: AddSnapArgs): Promise<PersistedSnap> {
async #add(args: AddSnapArgs): Promise<PersistedSnap> {

Copy link
Member

Choose a reason for hiding this comment

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

While we're at it, I really dislike having _ in names in general, I think the SnapController is the only place we do it. Might as well just make them normal names but have a private modifier.

Copy link
Member Author

@rekmarks rekmarks Oct 28, 2022

Choose a reason for hiding this comment

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

@Mrtenz Probably, but that would require more test refactoring than I am strictly willing to tackle right now 😅

Copy link
Member Author

Choose a reason for hiding this comment

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

@ritave Yeah that's a good point, we can address that in a follow-up.

Copy link
Member

Choose a reason for hiding this comment

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

Can you make an issue about it?

Copy link
Member

Choose a reason for hiding this comment

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

@rekmarks
Copy link
Member Author

Feel free to merge upon approval.

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.

imo this is good to go - @Mrtenz can you take another look

@FrederikBolding FrederikBolding merged commit e117212 into main Oct 31, 2022
@FrederikBolding FrederikBolding deleted the make-SnapController.add-private branch October 31, 2022 10:26
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.

None yet

4 participants