Skip to content

Add FXIOS-15030 [Relay] Unit test updates#32373

Open
mattreaganmozilla wants to merge 5 commits intomozilla-mobile:mainfrom
mattreaganmozilla:mr/15030
Open

Add FXIOS-15030 [Relay] Unit test updates#32373
mattreaganmozilla wants to merge 5 commits intomozilla-mobile:mainfrom
mattreaganmozilla:mr/15030

Conversation

@mattreaganmozilla
Copy link
Collaborator

📜 Tickets

Jira ticket

💡 Description

A couple updates to Relay unit tests, and fixes some prior nits.

📝 Checklist

  • I filled in the ticket numbers and a description of my work
  • I updated the PR name to follow our PR naming guidelines
  • I ensured unit tests pass and wrote tests for new code
  • If working on UI, I checked and implemented accessibility (Dynamic Text and VoiceOver)
  • If adding telemetry, I read the data stewardship requirements and will request a data review
  • If adding or modifying strings, I read the guidelines and will request a string review from l10n
  • If needed, I updated documentation and added comments to complex code

@mattreaganmozilla mattreaganmozilla requested a review from a team as a code owner March 3, 2026 22:31
@mattreaganmozilla
Copy link
Collaborator Author

One of the tests is failing on CI, taking a look

…an potentially run also which I believe is creating a potential race, but we can simply test that at least one of the updates has occurred which is valid
@mobiletest-ci-bot
Copy link

mobiletest-ci-bot commented Mar 4, 2026

Messages
📖 Project coverage: 40.32%

💪 Quality guardian

2 tests files modified. You're a champion of test coverage! 🚀

🧹 Tidy commit

Just 3 file(s) touched. Thanks for keeping it clean and review-friendly!

✅ New file code coverage

No new file detected so code coverage gate wasn't ran.

Client.app: Coverage: 38.43

File Coverage
RelayController.swift 62.75%

Generated by 🚫 Danger Swift against d8dd195

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.

Hi @mattreaganmozilla LGTM just added a couple of comments to the tests>

let subject = createSubject(accountStatus: .unavailable)
mockProfile.hasSyncableAccountMock = false
withExtendedLifetime(subject) {
wait(RelayController.RelayConstants.postLaunchDelay + 1.0)
Copy link
Collaborator

Choose a reason for hiding this comment

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

what if we inject the postLaunchDelay in the controller, so we can pass 0.0 in the tests ? we'd reduce the test time by 5 seconds.

Copy link
Collaborator

Choose a reason for hiding this comment

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

i'm wondering though if waiting for a time could lead to flaky tests ? what do you think ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

i'm wondering though if waiting for a time could lead to flaky tests ? what do you think ?

I think this is true to some degree of any test that waits for an async expectation, though we do test those in other areas, and sometimes it's unavoidable. I think the value of the test is worth having, but I can add a comment and if we see any flakiness in CI after these are added I can revisit this and/or remove them.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

what if we inject the postLaunchDelay in the controller, so we can pass 0.0 in the tests ? we'd reduce the test time by 5 seconds.

Yeah I was wondering about this also. Since we both had the same thought I'll update this to be part of the configuration that's injected during init.

Copy link
Collaborator

Choose a reason for hiding this comment

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

sounds great @mattreaganmozilla then i'm going to approve. Let's see for the flaky tests, if u can add a comment that would be great.

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.

3 participants