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

Refactor PasswordGeneratorTelemetry to use GleanWrapper #24332

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

Raine-Yang-UofT
Copy link

@Raine-Yang-UofT Raine-Yang-UofT commented Jan 24, 2025

📜 Tickets

Jira ticket
Github issue

💡 Description

This PR refactors the PasswordGeneratorTelemetry to inject a GleanWrapper instead of directly depending on Glean itself.

📜 Changes Made
Replaced direct dependency on Glean in PasswordGeneratorTelemetry with GleanWrapper.
Updated existing unit tests to mock the new GleanWrapper dependency.

📝 Checklist

You have to check all boxes before merging

  • Filled in the above information (tickets numbers and description of your work)
  • Updated the PR name to follow our PR naming guidelines
  • Wrote unit tests and/or ensured the tests suite is passing
  • When working on UI, I checked and implemented accessibility (minimum Dynamic Text and VoiceOver)
  • If needed, I updated documentation / comments for complex code and public methods
  • If needed, added a backport comment (example @Mergifyio backport release/v120)

@Raine-Yang-UofT Raine-Yang-UofT changed the title refactor: Refactor PasswordGeneratorTelemetry Refactor: Refactor PasswordGeneratorTelemetry Jan 24, 2025
@Raine-Yang-UofT Raine-Yang-UofT marked this pull request as ready for review January 24, 2025 22:53
@Raine-Yang-UofT Raine-Yang-UofT requested a review from a team as a code owner January 24, 2025 22:53
@Raine-Yang-UofT Raine-Yang-UofT changed the title Refactor: Refactor PasswordGeneratorTelemetry Refactor: refactor PasswordGeneratorTelemetry to use GleanWrapper Jan 24, 2025
@Raine-Yang-UofT Raine-Yang-UofT changed the title Refactor: refactor PasswordGeneratorTelemetry to use GleanWrapper Refactor PasswordGeneratorTelemetry to use GleanWrapper Jan 26, 2025
Copy link
Collaborator

@FilippoZazzeroni FilippoZazzeroni left a comment

Choose a reason for hiding this comment

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

LGTM great work 🎉 🎉 just a little nit a bout subject

super.tearDown()
}

func testShowPasswordGeneratorDialog() {
telemetry.passwordGeneratorDialogShown()
testCounterMetricRecordingSuccess(metric: GleanMetrics.PasswordGenerator.shown)
let subject = PasswordGeneratorTelemetry(gleanWrapper: gleanWrapper)
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: generally we prefer to encapsulate the subject into a method like:

private func subject(gleanWrapper: ...) -> PasswordGeneratorTelemetry {
}

so we align with other unit tests and if the size of the test increases we have the subject creation in one place.

@FilippoZazzeroni FilippoZazzeroni removed the request for review from Cramsden January 27, 2025 07:24
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.

2 participants