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

chore: add some tests to personal team - WPB-15469 #2446

Open
wants to merge 15 commits into
base: develop
Choose a base branch
from

Conversation

samwyndham
Copy link
Contributor

@samwyndham samwyndham commented Jan 29, 2025

TaskWPB-15469 [iOS] Improve personal to team bug fix (WPB-15275)

Issue

This PR adds some tests to the personal to team bug fix (WPB-15275). Unfortunately it in no way covers everything but I have some other priorities right now.

It also fixes some easy to fix warnings that I found randomly.

Testing

Run tests


Checklist

  • Title contains a reference JIRA issue number like [WPB-XXX].
  • Description is filled and free of optional paragraphs.
  • Adds/updates automated tests.

@@ -82,7 +82,7 @@ struct ConversationEventProcessor {
try await renameEventProcessor.processEvent(event)

case let .typing(event):
try await typingEventProcessor.processEvent(event)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixes warning

@@ -23,7 +23,7 @@ struct UserLegalholdDisableEventProcessor: UserLegalholdDisableEventProcessorPro
let repository: any UserRepositoryProtocol

func processEvent(_: UserLegalholdDisableEvent) async throws {
try await repository.disableUserLegalHold()
Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixes warning

@@ -23,7 +23,7 @@ struct UserUpdateEventProcessor: UserUpdateEventProcessorProtocol {
let repository: any UserRepositoryProtocol

func processEvent(_ event: UserUpdateEvent) async throws {
try await repository.updateUser(from: event)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixes warning

@@ -412,7 +412,7 @@ public final class ConversationRepository: ConversationRepositoryProtocol {
removedUsers: Set<UserID>,
reason: ConversationMemberLeaveReason
) async {
var systemMessageType: SystemMessageType = switch reason {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixes warning

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Changes in this file are just to fix warnings

@@ -151,7 +151,7 @@ extension AssetV3UploadRequestStrategy: ZMUpstreamTranscoder {
"sending request for asset",
attributes: [.nonce: message.nonce?.safeForLoggingDescription ?? "<nil>"]
)
var request: ZMTransportRequest? = if shouldUseBackgroundSession {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixes warning

@@ -121,7 +121,7 @@ extension ZMUserSession {

func errorFromFailedDeleteResponse(_ response: ZMTransportResponse!) -> NSError {

var errorCode: UserSessionErrorCode = switch response.result {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixes warning

@@ -39,7 +39,7 @@ final class AuthenticationEmailLoginUnknownErrorHandler: AuthenticationEventHand
}

// We try to validate the fields to detect an error
var detectedError: NSError = if !ZMUser.isValidEmailAddress(credentials.email) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixes warning

@@ -138,7 +138,7 @@ final class ValidatedTextField: AccessoryTextField, TextContainer {
self.textFieldValidator = TextFieldValidator()
self.kind = kind

var textFieldAttributes: Attributes = if setNewColors == false {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixes warning

@@ -77,7 +77,7 @@ final class LabelIndicator: UIView {
}

private func setupViews() {
var accessibilityString = switch context {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixes warning

@@ -155,7 +155,7 @@ final class ConversationNewDeviceSystemMessageCellDescription: ConversationMessa
)
let attributedText = attributedSenderNames

var linkTarget: View.LinkTarget = if let user = users.first, users.count == 1 {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixes warning

@@ -291,7 +291,7 @@ extension ConversationContentViewController: SignatureObserver {
}

private func presentDigitalSignatureErrorAlert(errorType: SignatureStatus.ErrorYpe) {
var message: String? = switch errorType {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixes warning

@@ -343,7 +343,7 @@ final class ConversationContentViewController: UIViewController {
return nil
}

let message = dataSource.messages[indexPath.section] as? ZMMessage
Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixes warning

@@ -85,7 +85,7 @@ final class CameraKeyboardPermissionsCell: UICollectionViewCell {

func configure(deniedAuthorization: DeniedAuthorizationType) {
typealias KeyboardPhotoAccessDeniedLocale = L10n.Localizable.KeyboardPhotosAccess.Denied.Keyboard
var title: String = switch deniedAuthorization {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixes warning

@@ -27,7 +27,7 @@ extension MainCoordinator: ArchivedListViewControllerDelegate where Dependencies
) {
Task { @MainActor in
await showConversationList(conversationFilter: .none)
await showConversation(conversation: conversation, message: nil)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixes warning

@@ -28,7 +28,7 @@ extension MainCoordinator: ConversationCreationControllerDelegate
) {
Task {
await showConversationList(conversationFilter: .none)
await showConversation(conversation: conversation, message: nil)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixes warning

@@ -37,7 +37,7 @@ extension ZClientViewController: StartUIDelegate {
// If the conversation exists, and is established (in case of mls),
// then we open the conversation
guard let conversation else { return }
await mainCoordinator.showConversation(conversation: conversation, message: nil)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixes warning

@@ -57,7 +57,7 @@ extension ZClientViewController: StartUIDelegate {
func startUIViewController(_ viewController: StartUIViewController, didSelect conversation: ZMConversation) {
Task {
await mainCoordinator.showConversationList(conversationFilter: .none)
await mainCoordinator.showConversation(conversation: conversation, message: nil)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixes warning

Copy link
Contributor

Test Results

    5 files      6 suites   10m 25s ⏱️
6 954 tests 6 926 ✅ 28 💤 0 ❌
6 964 runs  6 936 ✅ 28 💤 0 ❌

Results for commit 68f5a35.

@datadog-wireapp
Copy link

Datadog Report

Branch report: chore/personal-team-bug-cleanup-WPB-15469
Commit report: f17cbae
Test service: wire-ios-mono

✅ 0 Failed, 6645 Passed, 28 Skipped, 5m 11.17s Total Time

@caldrian caldrian changed the base branch from develop to release/cycle-3.117 January 30, 2025 09:39
@samwyndham samwyndham requested review from a team, netbe, caldrian and jullianm and removed request for a team and jullianm January 30, 2025 14:14
@netbe netbe changed the title chore: Add some tests to personal team - WPB-15469 chore: add some tests to personal team - WPB-15469 Jan 30, 2025
@samwyndham
Copy link
Contributor Author

netbe changed the title chore: Add some tests to personal team - WPB-15469 chore: add some tests to personal team - WPB-15469 11 hours ago

This whole time I've been capitalizing my PR titles incorrectly 🤦

Copy link
Collaborator

@netbe netbe left a comment

Choose a reason for hiding this comment

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

left a question before approving

}

private func product<T, U>(_ aCollection: [T], _ bCollection: [U]) -> [(T, U)] {
aCollection.flatMap { a in
Copy link
Collaborator

Choose a reason for hiding this comment

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

does it require that aCollection and bCollection are same size ?


let conversations = await context.perform { [self] in
product(connectionStatuses, conversationTypes).map { status, conversationType in
makeConnection(status: status, type: conversationType)
Copy link
Collaborator

Choose a reason for hiding this comment

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

suggestion: makeConversationWithConnection

Comment on lines +161 to +169
_ = try await createConversations([
.init(.oneOnOne, .mls, team: nil, users: [selfUser, userA], name: nil), // <- 1:1 MLS with UserA
.init(.oneOnOne, .mls, team: nil, users: [selfUser, userA], name: nil), // <- 1:1 MLS with UserA
.init(.group, .proteus, team: team, users: [selfUser, userA], name: nil), // <- 1:1 proteus fake with UserA
.init(.group, .proteus, team: team, users: [selfUser, userA], name: nil), // <- 1:1 proteus fake with UserA
.init(.oneOnOne, .proteus, team: nil, users: [selfUser, userA], name: nil), // <- 1:1 proteus with UserA
.init(.oneOnOne, .proteus, team: nil, users: [selfUser, userA], name: nil), // <- 1:1 proteus with UserA
.init(.connection, .proteus, team: nil, users: [selfUser, userA], name: nil), // <- 1:1 prot. pending UserA
.init(.connection, .proteus, team: nil, users: [selfUser, userA], name: nil) // <- 1:1 prot. pending UserA
Copy link
Collaborator

Choose a reason for hiding this comment

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

question: there are all doubled here? not sure what we're trying to test?

@netbe netbe changed the base branch from release/cycle-3.117 to develop February 12, 2025 12:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants