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

Bunn/dbp/entitlement check test #2756

Closed
wants to merge 4 commits into from
Closed

Conversation

Bunn
Copy link
Collaborator

@Bunn Bunn commented May 8, 2024

Task/Issue URL:
Tech Design URL:
CC:

Description:

Steps to test this PR:
1.


Internal references:

Pull Request Review Checklist
Software Engineering Expectations
Technical Design Template
Pull Request Documentation

Copy link
Contributor

github-actions bot commented May 8, 2024

Fails
🚫 Please, don't forget to add a link to the internal task

Generated by 🚫 dangerJS against 6ea7804

self.redeemUseCase = RedeemUseCase(authenticationService: authenticationService,
authenticationRepository: authenticationRepository)
self.subscriptionHandler = DataBrokerProtectionSubscriptionHandler(accountManager: AccountManager(subscriptionAppGroup: Bundle.main.appGroup(bundle: .subs)))
self.redeemUseCase = subscriptionHandler
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The subscription handler would replace the RedeemUseCase.
This self.redeemUseCase = subscriptionHandler is here just to validate the dependency tree, but it would be removed.

_ = ipcServiceManager
}

public func runOperationsAndStartSchedulerIfPossible() {
testSubscription()
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Just test to check if the library is being accessed, obviously would be removed

}
}

extension AccountManager: DataBrokerProtectionAccountManaging {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The idea here is to have a protocol just for DBP. Basically a wrapper to help with testing

}
}

extension DataBrokerProtectionSubscriptionHandler: DataBrokerProtectionRedeemUseCase {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Test code

import Subscription
import Common

public protocol DataBrokerProtectionAccountManaging {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The AccountManaging protocol from BSK doesn't have the entitlement call which we'd need in the future. This protocol is just to bridge the gap between the AccountManaging protocol and the Actual AccountManager because I didn't want to send a concrete type to the DataBrokerProtectionSubscriptionHandler

}

public func hasValidEntitlement() async -> Result<Bool, Error> {
SubscriptionPurchaseEnvironment.currentServiceEnvironment = settings.selectedEnvironment == .production ? .production : .staging
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

SubscriptionPurchaseEnvironment is a concrete type that doesn't have a protocol in the subscription package. I might do the same wrapper here or at least inject this dependency, this is just for test, entitlement handler will not be done in this project

@Bunn Bunn closed this Sep 20, 2024
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.

1 participant