Follow Up: add operationRepoLoadedListener and implement it to RecoverFromDroppe…#2075
Merged
jinliu9508 merged 2 commits intomainfrom May 6, 2024
Merged
Conversation
jkasten2
reviewed
May 3, 2024
Comment on lines
+596
to
+609
|
|
||
| test("IOperationRepoLoadedListener") { | ||
| val mocks = Mocks() | ||
| val mockIdentityModel = mockk<IdentityModel>() | ||
| val mockIdentityModelStore = mockk<IdentityModelStore>() | ||
| val recovery = RecoverFromDroppedLoginBug(mocks.operationRepo, mockIdentityModelStore, mocks.configModelStore) | ||
|
|
||
| mocks.operationRepo.start() | ||
| recovery.start() | ||
|
|
||
| verify { | ||
| mocks.operationRepo.subscribe(recovery) | ||
| } | ||
| } |
Member
There was a problem hiding this comment.
This is testing RecoverFromDroppedLoginBug instead of OperationRepo, as the only thing we are verifying is that operationRepo.subscribe was called. This is a fine test, but such a test would belong in RecoverFromDroppedLoginBugTest.kt.
If we want to test the new OperationRepo feature, we should test that it actually fired the event instead.
Contributor
Author
There was a problem hiding this comment.
Good point! I have fixed that and add one test unit in each class to ensure the event listener works correctly.
jkasten2
approved these changes
May 6, 2024
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
One Line Summary
This is a followup PR to address a broken change made by this PR #2068
Details
Motivation
The PR mentioned above has made the initialization of OperationRepo asynchronous that we can no longer assume all saved operations are loaded at start. This PR adds an event listener to RecoverFromDroppedLoginBug so that it listens to the loading completion event and starts the recovery after the loading has completed.
Scope
The recover does no longer begin at start. Instead, it will begin when it receives the event notifier that the loading of OperationRepo has completed.
Testing
Unit testing
I have added two test units to ensure both classes are working properly.
Manual testing
My manual testing step:
Affected code checklist
Checklist
Overview
Testing
Final pass
This change is