Fix undo persistence test#2741
Merged
raineorshine merged 3 commits intocybersemics:mainfrom Dec 28, 2024
Merged
Conversation
raineorshine
approved these changes
Dec 28, 2024
Contributor
raineorshine
left a comment
There was a problem hiding this comment.
Great, thanks for the explanation. I will merge this as a solution for #2145 and we can try to spot the deeper issue with test store isolation.
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.
This fixes the remaining undo/redo test.
Problem #1: It looks like we must use fake timers if we want the
storestate to be updated based on database operations (e.g., if we useinitialize()to reload the state). I think this is because thethoughtspaceoperations are asynchronous and don't call the store operations prior to the test ending. (I'm not sure why we didn't get other errors that made this clear.)Problem #2: There appears to be some store state that isn't cleaned up between tests that persists from the previous tests and breaks this one. The other tests probably aren't effected because they all call
createTestStore, which presumably creates a brand new store.This second issue is somewhat ancillary but might come up when mixing tests that do/don't require
createTestStoreand should figure out the root cause at some point. My initial guess is that we'll just need to figure out a way reverse whatever happens increateTestStore.Closes #2145