-
Notifications
You must be signed in to change notification settings - Fork 3k
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
base: main
Are you sure you want to change the base?
Refactor PasswordGeneratorTelemetry
to use GleanWrapper
#24332
Conversation
PasswordGeneratorTelemetry
PasswordGeneratorTelemetry
PasswordGeneratorTelemetry
PasswordGeneratorTelemetry
to use GleanWrapper
PasswordGeneratorTelemetry
to use GleanWrapper
PasswordGeneratorTelemetry
to use GleanWrapper
There was a problem hiding this 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) |
There was a problem hiding this comment.
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.
XCTAssertEqual(gleanWrapper.incrementCounterCalled, 1) | ||
} | ||
|
||
private func createSubject() -> PasswordGeneratorTelemetry { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we inject the Glean wrapper into the createSubject directly, so we don't depend on the class variable ?
📜 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
@Mergifyio backport release/v120
)